Encoder, decoder, encoding method, and decoding method

ABSTRACT

Various embodiments provide an encoder that performs an up-conversion and a down-conversion on a first quantization matrix to generate a second quantization matrix, and quantizes transform coefficients of a current block using the second quantization matrix. The first quantization matrix has a first number of rows and a first number of columns equal to the first number of rows, and the second quantization matrix has a second number of rows and a second number of columns different from the second number of rows. In the up-conversion, the circuitry generates the second quantization matrix such that one of the second number of rows or the second number of columns is larger than the first number of rows. In the down-conversion, the circuitry generates the second quantization matrix such that the other of the second number of rows or the second number of columns is smaller than the first number of rows.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a U.S. continuation application of U.S. applicationSer. No. 17/883,445 filed on Aug. 8, 2022, which is a U.S. continuationapplication of U.S. application Ser. No. 17/034,825 filed on Sep. 28,2020, which is a U.S. continuation application of PCT InternationalPatent Application Number PCT/JP2019/013154 filed on Mar. 27, 2019,claiming the benefit of priority of U.S. Provisional Patent ApplicationNo. 62/650,458 filed on Mar. 30, 2018, the entire contents of which arehereby incorporated by reference.

BACKGROUND Technical Field

This disclosure relates to video coding, and particularly to videoencoding and decoding systems, components, and methods in video codingand decoding.

Description of the Related Art

With advancements in video coding technology, from H.261 and MPEG-1 toH.264/AVC (Advanced Video Coding), MPEG-LA, H.265/HEVC (High EfficiencyVideo Coding) and H.266/VVC (Versatile Video Codec), there remains aconstant need to provide improvements and optimizations to the videocoding technology to process an ever-increasing amount of digital videodata in various applications. This disclosure relates to furtheradvancements, improvements and optimizations in video coding.

BRIEF SUMMARY

An encoder according to an embodiment of the present disclosure is anencoder that includes circuitry and memory. Using the memory, thecircuitry: performs an up-conversion and a down-conversion on a firstquantization matrix to generate a second quantization matrix, andquantizes transform coefficients of a current block using the secondquantization matrix. The first quantization matrix has a first number ofrows and a first number of columns equal to the first number of rows toform a square matrix, and the second quantization matrix has a secondnumber of rows and a second number of columns different from the secondnumber of rows to form a rectangular matrix. In the up-conversion, thecircuitry generates the second quantization matrix such that one of thesecond number of rows and the second number of columns is larger thanthe first number of rows. In the down-conversion, the circuitrygenerates the second quantization matrix such that the other of thesecond number of rows and the second number of columns is smaller thanthe first number of rows.

A decoder according to an embodiment of the present disclosure is adecoder that includes circuitry and memory. Using the memory, thecircuitry: performs an up-conversion and a down-conversion on a firstquantization matrix to generate a second quantization matrix, andinverse quantizes quantized coefficients of a current block using thesecond quantization matrix. The first quantization matrix has a firstnumber of rows and a first number of columns equal to the first numberof rows to form a square matrix, and the second quantization matrix hasa second number of rows and a second number of columns different fromthe second number of rows to form a rectangular matrix. In theup-conversion, the circuitry generates the second quantization matrixsuch that one of the second number of rows and the second number ofcolumns is larger than the first number of rows. In the down-conversion,the circuitry generates the second quantization matrix such that theother of the second number of rows and the second number of columns issmaller than the first number of rows.

An encoding method according to an embodiment of the present disclosureincludes performing an up-conversion and a down-conversion on a firstquantization matrix to generate a second quantization matrix, andquantizing transform coefficients of a current block using the secondquantization matrix. The first quantization matrix has a first number ofrows and a first number of columns equal to the first number of rows toform a square matrix, and the second quantization matrix has a secondnumber of rows and a second number of columns different from the secondnumber of rows to form a rectangular matrix. In the up-conversion, thesecond quantization matrix is generated such that one of the secondnumber of rows and the second number of columns is larger than the firstnumber of rows. In the down-conversion, the second quantization matrixis generated such that the other of the second number of rows and thesecond number of columns is smaller than the first number of rows.

A decoding method according to an embodiment of the present disclosureincludes performing an up-conversion and a down-conversion on a firstquantization matrix to generate a second quantization matrix, andinverse quantizing quantized coefficients of a current block using thesecond quantization matrix. The first quantization matrix has a firstnumber of rows and a first number of columns equal to the first numberof rows to form a square matrix, and the second quantization matrix hasa second number of rows and a second number of columns different fromthe second number of rows to form a rectangular matrix. In theup-conversion, the second quantization matrix is generated such that oneof the second number of rows and the second number of columns is largerthan the first number of rows. In the down-conversion, the secondquantization matrix is generated such that the other of the secondnumber of rows and the second number of columns is smaller than thefirst number of rows.

In video coding technology, it is desirable to propose new methods inorder to improve coding efficiency, enhance image quality, and reducecircuit scale. Some implementations of embodiments of the presentdisclosure, including constituent elements of embodiments of the presentdisclosure considered alone or in various combinations, may facilitateone or more of the following: improvement in coding efficiency,enhancement in image quality, reduction in utilization of processingresources associated with encoding/decoding, reduction in circuit scale,improvement in processing speed of encoding/decoding, etc.

In addition, some implementations of embodiments of the presentdisclosure, including constituent elements of embodiments of the presentdisclosure considered alone or in various combinations, may facilitate,in encoding and decoding, appropriate selection of one or more elements,such as a filter, a block, a size, a motion vector, a reference picture,a reference block or an operation. It is to be noted that the presentdisclosure includes disclosure regarding configurations and methodswhich may provide advantages other than the above-described advantages.Examples of such configurations and methods include a configuration ormethod for improving coding efficiency while reducing an increase in theuse of processing resources.

Additional benefits and advantages of the disclosed embodiments willbecome apparent from the specification and drawings. The benefits and/oradvantages may be individually obtained by the various embodiments andfeatures of the specification and drawings, not all of which need to beprovided in order to obtain one or more of such benefits and/oradvantages.

It should be noted that general or specific embodiments may beimplemented as a system, a method, an integrated circuit, a computerprogram, a storage medium, or any selective combination thereof.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 is a schematic diagram illustrating one example of a functionalconfiguration of a transmission system according to an embodiment.

FIG. 2 is a conceptual diagram for illustrating one example of ahierarchical structure of data in a stream.

FIG. 3 is a conceptual diagram for illustrating one example of a sliceconfiguration.

FIG. 4 is a conceptual diagram for illustrating one example of a tileconfiguration.

FIG. 5 is a conceptual diagram for illustrating one example of anencoding structure in scalable encoding.

FIG. 6 is a conceptual diagram for illustrating one example of anencoding structure in scalable encoding.

FIG. 7 is a block diagram illustrating a functional configuration of anencoder according to an embodiment.

FIG. 8 is functional block diagram illustrating a mounting example ofthe encoder.

FIG. 9 is a flow chart indicating one example of an overall encodingprocess performed by the encoder.

FIG. 10 is a conceptual diagram for illustrating one example of blocksplitting.

FIG. 11 is a block diagram illustrating one example of a functionalconfiguration of a splitter according to an embodiment.

FIG. 12 is a conceptual diagram for illustrating examples of splittingpatterns.

FIG. 13A is a conceptual diagram for illustrating one example of asyntax tree of a splitting pattern.

FIG. 13B is a conceptual diagram for illustrating another example of asyntax tree of a splitting pattern.

FIG. 14 is a chart indicating example transform basis functions forvarious transform types.

FIG. 15 is a conceptual diagram for illustrating example spatiallyvarying transforms (SVT).

FIG. 16 is a flow chart illustrating one example of a process performedby a transformer.

FIG. 17 is a flow chart illustrating another example of a processperformed by the transformer.

FIG. 18 is a block diagram illustrating one example of a functionalconfiguration of a quantizer according to an embodiment.

FIG. 19 is a flow chart illustrating one example of quantization processperformed by the quantizer.

FIG. 20 is a block diagram illustrating one example of a functionalconfiguration of an entropy encoder according to an embodiment.

FIG. 21 is a conceptual diagram for illustrating an example flow of acontext-based adaptive binary arithmetic coding (CABAC) process in theentropy encoder.

FIG. 22 is a block diagram illustrating one example of a functionalconfiguration of loop filter according to an embodiment.

FIG. 23A is a conceptual diagram for illustrating one example of afilter shape used in an adaptive loop filter (ALF).

FIG. 23B is a conceptual diagram for illustrating another example of afilter shape used in an ALF.

FIG. 23C is a conceptual diagram for illustrating another example of afilter shape used in an ALF.

FIG. 23D is a conceptual diagram for illustrating an example flow of across component ALF (CC-ALF).

FIG. 23E is a conceptual diagram for illustrating an example of a filtershape used in a CC-ALF.

FIG. 23F is a conceptual diagram for illustrating an example flow of aJoint Chroma CCALF (JC-CCALF).

FIG. 23G is a table illustrating example weight index candidates thatmay be employed in a JC-CCALF.

FIG. 24 is a block diagram indicating one example of a specificconfiguration of a loop filter which functions as a deblocking filter(DBF).

FIG. 25 is a conceptual diagram for illustrating an example of adeblocking filter having a symmetrical filtering characteristic withrespect to a block boundary.

FIG. 26 is a conceptual diagram for illustrating a block boundary onwhich a deblocking filter process is performed.

FIG. 27 is a conceptual diagram for illustrating examples of Boundarystrength (Bs) values.

FIG. 28 is a flow chart illustrating one example of a process performedby a predictor of the encoder.

FIG. 29 is a flow chart illustrating another example of a processperformed by the predictor of the encoder.

FIG. 30 is a flow chart illustrating another example of a processperformed by the predictor of the encoder.

FIG. 31 is a conceptual diagram for illustrating sixty-seven intraprediction modes used in intra prediction in an embodiment.

FIG. 32 is a flow chart illustrating one example of a process performedby an intra predictor.

FIG. 33 is a conceptual diagram for illustrating examples of referencepictures.

FIG. 34 is a conceptual diagram for illustrating examples of referencepicture lists.

FIG. 35 is a flow chart illustrating an example basic processing flow ofinter prediction.

FIG. 36 is a flow chart illustrating one example of a process ofderivation of motion vectors.

FIG. 37 is a flow chart illustrating another example of a process ofderivation of motion vectors.

FIGS. 38A and 38B are conceptual diagrams for illustrating examplecharacterizations of modes for MV derivation.

FIG. 39 is a flow chart illustrating an example of a process of interprediction in normal inter mode.

FIG. 40 is a flow chart illustrating an example of a process of interprediction in normal merge mode.

FIG. 41 is a conceptual diagram for illustrating one example of a motionvector derivation process in merge mode.

FIG. 42 is a conceptual diagram for illustrating one example of a MVderivation process for a current picture by HMVP merge mode.

FIG. 43 is a flow chart illustrating one example of a frame rate upconversion (FRUC) process.

FIG. 44 is a conceptual diagram for illustrating one example of patternmatching (bilateral matching) between two blocks along a motiontrajectory.

FIG. 45 is a conceptual diagram for illustrating one example of patternmatching (template matching) between a template in a current picture anda block in a reference picture.

FIG. 46A is a conceptual diagram for illustrating one example ofderiving a motion vector of each sub-block based on motion vectors of aplurality of neighboring blocks.

FIG. 46B is a conceptual diagram for illustrating one example ofderiving a motion vector of each sub-block in affine mode in which threecontrol points are used.

FIG. 47A is a conceptual diagram for illustrating an example MVderivation at control points in an affine mode.

FIG. 47B is a conceptual diagram for illustrating an example MVderivation at control points in an affine mode.

FIG. 47C is a conceptual diagram for illustrating an example MVderivation at control points in an affine mode.

FIG. 48A is a conceptual diagram for illustrating an affine mode inwhich two control points are used.

FIG. 48B is a conceptual diagram for illustrating an affine mode inwhich three control points are used.

FIG. 49A is a conceptual diagram for illustrating one example of amethod for MV derivation at control points when the number of controlpoints for an encoded block and the number of control points for acurrent block are different from each other.

FIG. 49B is a conceptual diagram for illustrating another example of amethod for MV derivation at control points when the number of controlpoints for an encoded block and the number of control points for acurrent block are different from each other.

FIG. 50 is a flow chart illustrating one example of a process in affinemerge mode.

FIG. 51 is a flow chart illustrating one example of a process in affineinter mode.

FIG. 52A is a conceptual diagram for illustrating generation of twotriangular prediction images.

FIG. 52B is a conceptual diagram for illustrating examples of a firstportion of a first partition which overlaps with a second partition, andfirst and second sets of samples which may be weighted as part of acorrection process.

FIG. 52C is a conceptual diagram for illustrating a first portion of afirst partition, which is a portion of the first partition that overlapswith a portion of an adjacent partition.

FIG. 53 is a flow chart illustrating one example of a process in atriangle mode.

FIG. 54 is a conceptual diagram for illustrating one example of anAdvanced Temporal Motion Vector Prediction (ATMVP) mode in which a MV isderived in units of a sub-block.

FIG. 55 is a flow chart illustrating a relationship between a merge modeand dynamic motion vector refreshing (DMVR).

FIG. 56 is a conceptual diagram for illustrating one example of DMVR.

FIG. 57 is a conceptual diagram for illustrating another example of DMVRfor determining a MV.

FIG. 58A is a conceptual diagram for illustrating one example of motionestimation in DMVR.

FIG. 58B is a flow chart illustrating one example of a process of motionestimation in DMVR.

FIG. 59 is a flow chart illustrating one example of a process ofgeneration of a prediction image.

FIG. 60 is a flow chart illustrating another example of a process ofgeneration of a prediction image.

FIG. 61 is a flow chart illustrating one example of a correction processof a prediction image by overlapped block motion compensation (OBMC).

FIG. 62 is a conceptual diagram for illustrating one example of aprediction image correction process by OBMC.

FIG. 63 is a conceptual diagram for illustrating a model assuminguniform linear motion.

FIG. 64 is a flow chart illustrating one example of a process of interprediction according to BIO.

FIG. 65 is a functional block diagram illustrating one example of afunctional configuration of an inter predictor which may perform interprediction according to BIO.

FIG. 66A is a conceptual diagram for illustrating one example of processof a prediction image generation method using a luminance correctionprocess performed by LIC.

FIG. 66B is a flow chart illustrating one example of a process ofprediction image generation method using the LIC.

FIG. 67 is a block diagram illustrating a functional configuration of adecoder according to an embodiment.

FIG. 68 is a functional block diagram illustrating a mounting example ofa decoder.

FIG. 69 is a flow chart illustrating one example of an overall decodingprocess performed by the decoder.

FIG. 70 is a conceptual diagram for illustrating a relationship betweena splitting determiner and other constituent elements.

FIG. 71 is a block diagram illustrating one example of a functionalconfiguration of an entropy decoder.

FIG. 72 is a conceptual diagram for illustrating an example flow of aCABAC process in the entropy decoder.

FIG. 73 is a block diagram illustrating one example of a functionalconfiguration of an inverse quantizer.

FIG. 74 is a flow chart illustrating one example of a process of inversequantization performed by the inverse quantizer.

FIG. 75 is a flow chart illustrating one example of a process performedby an inverse transformer.

FIG. 76 is a flow chart illustrating another example of a processperformed by the inverse transformer.

FIG. 77 is a block diagram illustrating one example of a functionalconfiguration of a loop filter.

FIG. 78 is a flow chart illustrating one example of a process performedby a predictor of the decoder.

FIG. 79 is a flow chart illustrating another example of a processperformed by the predictor of the decoder.

FIGS. 80A to 80C are a flow chart illustrating another example of aprocess performed by the predictor of the decoder.

FIG. 81 is a diagram illustrating one example of a process performed byan intra predictor of the decoder.

FIG. 82 is a flow chart illustrating one example of a process of MVderivation in the decoder.

FIG. 83 is a flow chart illustrating another example of a process of MVderivation in the decoder.

FIG. 84 is a flow chart illustrating an example of a process of interprediction by normal inter mode in the decoder.

FIG. 85 is a flow chart illustrating an example of a process of interprediction by normal merge mode in the decoder.

FIG. 86 is a flow chart illustrating an example of a process of interprediction by FRUC mode in the decoder.

FIG. 87 is a flow chart illustrating an example of a process of interprediction by affine merge mode in the decoder.

FIG. 88 is a flow chart illustrating an example of a process of interprediction by affine inter mode in the decoder.

FIG. 89 is a flow chart illustrating an example of a process of interprediction by triangle mode in the decoder.

FIG. 90 is a flow chart illustrating an example of a process of motionestimation by DMVR in the decoder.

FIG. 91 is a flow chart illustrating one example process of motionestimation by DMVR in the decoder.

FIG. 92 is a flow chart illustrating one example of a process ofgeneration of a prediction image in the decoder.

FIG. 93 is a flow chart illustrating another example of a process ofgeneration of a prediction image in the decoder.

FIG. 94 is a flow chart illustrating an example of a process ofcorrection of a prediction image by OBMC in the decoder.

FIG. 95 is a flow chart illustrating an example of a process ofcorrection of a prediction image by BIO in the decoder.

FIG. 96 is a flow chart illustrating an example of a process ofcorrection of a prediction image by LIC in the decoder.

FIG. 97 illustrates a first example of a flow of an encoding processusing quantization matrices performed by an encoder.

FIG. 98 illustrates an example of a flow of a decoding process usingquantization matrices performed by a decoder corresponding to theencoder described with reference to FIG. 97 .

FIG. 99 is a diagram for explaining a first example of generating arectangular block quantization matrix from a square block quantizationmatrix in FIG. 97 or in FIG. 98 .

FIG. 100 is a diagram for explaining a method of generating arectangular block quantization matrix by down-converting thecorresponding square block quantization matrix, which is described withreference to FIG. 99 .

FIG. 101 is a diagram for explaining a second example of generating arectangular block quantization matrix from a square block quantizationmatrix in FIG. 97 or in FIG. 98 .

FIG. 102 is a diagram for explaining a method of generating arectangular block quantization matrix by up-converting the correspondingsquare block quantization matrix, which is described with reference toFIG. 101 .

FIG. 103 illustrates a second example of the flow of the encodingprocess using quantization matrices performed by an encoder.

FIG. 104 illustrates an example of the flow of the decoding processusing quantization matrices performed by a decoder corresponding to theencoder described with reference to FIG. 103 .

FIG. 105 is a diagram for explaining examples of a quantization matrixwhich correspond to the size of an effective transform coefficientregion in a current block having a different size, and is generated inFIG. 103 or in FIG. 104 .

FIG. 106 illustrates a variation of the second example of the flow ofthe encoding process using quantization matrices performed by anencoder.

FIG. 107 illustrates an example of the flow of the decoding processusing quantization matrices performed by a decoder corresponding to theencoder described with reference to FIG. 106 .

FIG. 108 is a diagram for explaining a first example of generating arectangular block quantization matrix from a square block quantizationmatrix in FIG. 106 or in FIG. 107 .

FIG. 109 is a diagram for explaining a method of generating arectangular block quantization matrix by down-converting thecorresponding square block quantization matrix, which is described withreference to FIG. 108 .

FIG. 110 is a diagram for explaining a second example of generating arectangular block quantization matrix from a square block quantizationmatrix in FIG. 106 or in FIG. 107 .

FIG. 111 is a diagram for explaining a method of generating arectangular block quantization matrix by up-converting the correspondingsquare block quantization matrix, which is described with reference toFIG. 110 .

FIG. 112 illustrates a third example of the flow of the encoding processusing quantization matrices performed by an encoder.

FIG. 113 illustrates an example of the flow of the decoding processusing quantization matrices performed by a decoder corresponding to theencoder described with reference to FIG. 112 .

FIG. 114 is a diagram for explaining one example of a method ofgenerating, using a common method, a quantization matrix from quantizedcoefficient values in a quantization matrix including only quantizedcoefficients corresponding to the diagonal components of a current blockhaving a different size, which is performed in FIG. 112 or in FIG. 113 .

FIG. 115 is a diagram for explaining another example of a method ofgenerating, using a common method, a quantization matrix from quantizedcoefficient values in a quantization matrix including only quantizedcoefficients for the diagonal components of a current block having adifferent size, which is performed in FIG. 112 or in FIG. 113 .

FIG. 116 is a block diagram illustrating an example of implementation ofan encoder;

FIG. 117 is a flowchart illustrating an example of an operationperformed by the encoder illustrated in FIG. 116 .

FIG. 118 is a block diagram illustrating an example of implementation ofa decoder;

FIG. 119 is a flowchart illustrating an example of an operationperformed by the decoder illustrated in FIG. 118 .

FIG. 120 is a diagram illustrating an example overall configuration of acontent providing system for implementing a content distributionservice.

FIG. 121 is a conceptual diagram for illustrating an example of adisplay screen of a web page.

FIG. 122 is a conceptual diagram for illustrating an example of adisplay screen of a web page.

FIG. 123 is a block diagram illustrating one example of a smartphone.

FIG. 124 is a block diagram illustrating an example of a functionalconfiguration of a smartphone.

DETAILED DESCRIPTION

In the drawings, identical reference numbers identify similar elements,unless the context indicates otherwise. The sizes and relative positionsof elements in the drawings are not necessarily drawn to scale.

Hereinafter, embodiments will be described with reference to thedrawings. Note that the embodiments described below each show a generalor specific example. The numerical values, shapes, materials,components, the arrangement and connection of the components, steps, therelation and order of the steps, etc., indicated in the followingembodiments are mere examples, and are not intended to limit the scopeof the claims.

Embodiments of an encoder and a decoder will be described below. Theembodiments are examples of an encoder and a decoder to which theprocesses and/or configurations presented in the description of aspectsof the present disclosure are applicable. The processes and/orconfigurations can also be implemented in an encoder and a decoderdifferent from those according to the embodiments. For example,regarding the processes and/or configurations as applied to theembodiments, any of the following may be implemented:

(1) Any of the components of the encoder or the decoder according to theembodiments presented in the description of aspects of the presentdisclosure may be substituted or combined with another componentpresented anywhere in the description of aspects of the presentdisclosure.

(2) In the encoder or the decoder according to the embodiments,discretionary changes may be made to functions or processes performed byone or more components of the encoder or the decoder, such as addition,substitution, removal, etc., of the functions or processes. For example,any function or process may be substituted or combined with anotherfunction or process presented anywhere in the description of aspects ofthe present disclosure.

(3) In methods implemented by the encoder or the decoder according tothe embodiments, discretionary changes may be made such as addition,substitution, and removal of one or more of the processes included inthe method. For example, any process in the method may be substituted orcombined with another process presented anywhere in the description ofaspects of the present disclosure.

(4) One or more components included in the encoder or the decoderaccording to embodiments may be combined with a component presentedanywhere in the description of aspects of the present disclosure, may becombined with a component including one or more functions presentedanywhere in the description of aspects of the present disclosure, andmay be combined with a component that implements one or more processesimplemented by a component presented in the description of aspects ofthe present disclosure.

(5) A component including one or more functions of the encoder or thedecoder according to the embodiments, or a component that implements oneor more processes of the encoder or the decoder according to theembodiments, may be combined or substituted with a component presentedanywhere in the description of aspects of the present disclosure, with acomponent including one or more functions presented anywhere in thedescription of aspects of the present disclosure, or with a componentthat implements one or more processes presented anywhere in thedescription of aspects of the present disclosure.

(6) In methods implemented by the encoder or the decoder according tothe embodiments, any of the processes included in the method may besubstituted or combined with a process presented anywhere in thedescription of aspects of the present disclosure or with anycorresponding or equivalent process.

(7) One or more processes included in methods implemented by the encoderor the decoder according to the embodiments may be combined with aprocess presented anywhere in the description of aspects of the presentdisclosure.

(8) The implementation of the processes and/or configurations presentedin the description of aspects of the present disclosure is not limitedto the encoder or the decoder according to the embodiments. For example,the processes and/or configurations may be implemented in a device usedfor a purpose different from the moving picture encoder or the movingpicture decoder disclosed in the embodiments.

[Definitions of Terms]

The respective terms may be defined as indicated below as examples.

An image is a data unit configured with a set of pixels, is a picture,or includes blocks smaller than a pixel. Images include a still image inaddition to a video.

A picture is an image processing unit configured with a set of pixels,and also may be referred to as a frame or a field. A picture may, forexample, take the form of an array of luma samples in monochrome formator an array of luma samples and two corresponding arrays of chromasamples in 4:2:0, 4:2:2, and 4:4:4 color format.

A block is a processing unit which is a set of a determined number ofpixels. Blocks may have any number of different shapes. For example, ablock may have a rectangular shape of M×N (M-column by N-row) pixels, asquare shape of M×M pixels, a triangular shape, a circular shape, etc.Examples of blocks include slices, tiles, bricks, CTUs, super blocks,basic splitting units, VPDUs, processing splitting units for hardware,CUs, processing block units, prediction block units (PUs) orthogonaltransform block units (TUs), units, and sub-blocks. A block may take theform of an M×N array of samples, or an M×N array of transformcoefficients. For example, a block may be a square or rectangular regionof pixels including one Luma and two Chroma matrices.

A pixel or sample is a smallest point of an image. Pixels or samplesinclude a pixel at an integer position, as well as pixels at sub-pixelpositions, e.g., generated based on a pixel at an integer position.

A pixel value or a sample value is an eigenvalue of a pixel. Pixelvalues or sample values may include one or more of a luma value, achroma value, an RGB gradation level, a depth value, binary values ofzero or 1, etc.

Chroma or chrominance is an intensity of a color, typically representedby the symbols Cb and Cr, which specify that values of a sample array ora single sample value represent values of one of two color differencesignals related to the primary colors.

Luma or luminance is a brightness of an image, typically represented bythe symbol or the subscript Y or L, which specify that values of asample array or a single sample value represent values of a monochromesignal related to the primary colors.

A flag comprises one or more bits which indicate a value, for example,of a parameter or index. A flag may be a binary flag which indicates abinary value of the flag, which also may indicate a non-binary value ofa parameter.

A signal conveys information, which is symbolized by or encoded into thesignal. Signals include discrete digital signals and continuous analogsignals.

A stream or a bitstream is a digital data string of a digital data flow.A stream or bitstream may be one stream or may be configured with aplurality of streams having a plurality of hierarchical layers. A streamor bitstream may be transmitted in serial communication using a singletransmission path, or may be transmitted in packet communication using aplurality of transmission paths.

A difference refers to various mathematical differences, such as asimple difference (x−y), an absolute value of a difference (|x−y|), asquared difference (x{circumflex over ( )}2−y{circumflex over ( )}2), asquare root of a difference (√(x−y)), a weighted difference (ax−by: aand b are constants), an offset difference (x−y+a: a is an offset), etc.In the case of scalar quantity, a simple difference may suffice, and adifference calculation be included.

A sum refers to various mathematical sums, such as a simple sum (x+y),an absolute value of a sum (|x+y|), a squared sum (x{circumflex over( )}2+y{circumflex over ( )}2), a square root of a sum (√(x+y)), aweighted difference (ax+by: a and b are constants), an offset sum(x+y+a: a is an offset), etc. In the case of scalar quantity, a simplesum may suffice, and a sum calculation be included.

A frame is the composition of a top field and a bottom field, wheresample rows 0, 2, 4, . . . originate from the top field and sample rows1, 3, 5, . . . originate from the bottom field.

A slice is an integer number of coding tree units contained in oneindependent slice segment and all subsequent dependent slice segments(if any) that precede the next independent slice segment (if any) withinthe same access unit.

A tile is a rectangular region of coding tree blocks within a particulartile column and a particular tile row in a picture. A tile may be arectangular region of the frame that is intended to be able to bedecoded and encoded independently, although loop-filtering across tileedges may still be applied.

A coding tree unit (CTU) may be a coding tree block of luma samples of apicture that has three sample arrays, or two corresponding coding treeblocks of chroma samples. Alternatively, a CTU may be a coding treeblock of samples of one of a monochrome picture and a picture that iscoded using three separate color planes and syntax structures used tocode the samples. A super block may be a square block of 64×64 pixelsthat consists of either 1 or 2 mode info blocks or is recursivelypartitioned into four 32×32 blocks, which themselves can be furtherpartitioned.

[System Configuration]

First, a transmission system according to an embodiment will bedescribed. FIG. 1 is a schematic diagram illustrating one example of aconfiguration of a transmission system 400 according to an embodiment.

The transmission system 400 is a system which transmits a streamgenerated by encoding an image and decodes the transmitted stream. Asillustrated, transmission system 400 includes an encoder 100, a network300, and decoder 200 as illustrated in FIG. 1 .

An image is input to encoder 100. Encoder 100 generates a stream byencoding the input image, and outputs the stream to network 300. Thestream includes, for example, the encoded image and control informationfor decoding the encoded image. The image is compressed by the encoding.

It is to be noted that an image before being encoded by the encoder 100is also referred to as the original image, the original signal, or theoriginal sample. The image may be a video or a still image. An image isa generic concept of a sequence, a picture, and a block, and thus is notlimited to a spatial region having a particular size and to a temporalregion having a particular size unless otherwise specified. An image isan array of pixels or pixel values, and the signal representing theimage or pixel values are also referred to as samples. The stream may bereferred to as a bitstream, an encoded bitstream, a compressedbitstream, or an encoded signal. Furthermore, the encoder 100 may bereferred to as an image encoder or a video encoder. The encoding methodperformed by encoder 100 may be referred to as an encoding method, animage encoding method, or a video encoding method.

The network 300 transmits the stream generated by encoder 100 to decoder200. The network 200 may be the Internet, a Wide Area Network (WAN), aLocal Area Network (LAN), or any combination of networks. The network300 is not limited to a bi-directional communication network, and may bea uni-directional communication network which transmits broadcast wavesof digital terrestrial broadcasting, satellite broadcasting, or thelike. Alternatively, the network 300 may be replaced by a recordingmedium such as a Digital Versatile Disc (DVD) and a Blue-Ray Disc (BD),etc. on which a stream is recorded.

The decoder 200 generates, for example, a decoded image which is anuncompressed image, by decoding a stream transmitted by network 300. Forexample, the decoder decodes a stream according to a decoding methodcorresponding to an encoding method employed by encoder 100.

It is to be noted that the decoder 200 may also be referred to as animage decoder or a video decoder, and that the decoding method performedby the decoder 200 may also be referred to as a decoding method, animage decoding method, or a video decoding method.

[Data Structure]

FIG. 2 is a conceptual diagram for illustrating one example of ahierarchical structure of data in a stream. For convenience, FIG. 2 willbe described with reference to the transmission system 400 of FIG. 1 . Astream includes, for example, a video sequence. As illustrated in (a) ofFIG. 2 , the video sequence includes a one or more video parameter sets(VPS), one or more sequence parameter sets (SPS), one or more pictureparameter sets (PPS), supplemental enhancement information (SEI), and aplurality of pictures.

In a video having a plurality of layers, a VPS may include a codingparameter which is common between some of the plurality of layers, and acoding parameter related to some of the plurality of layers included inthe video or to an individual layer.

An SPS includes a parameter which is used for a sequence, that is, acoding parameter which the decoder 200 refers to in order to decode thesequence. For example, the coding parameter may indicate the width orheight of a picture. It is to be noted that a plurality of SPSs may bepresent.

A PPS includes a parameter which is used for a picture, that is, acoding parameter which the decoder 200 refers to in order to decode eachof the pictures in the sequence. For example, the coding parameter mayinclude a reference value for a quantization width which is used todecode a picture and a flag indicating application of weightedprediction. It is to be noted that a plurality of PPSs may be present.Each of the SPS and the PPS may be simply referred to as a parameterset.

As illustrated in (b) of FIG. 2 , a picture may include a picture headerand one or more slices. A picture header includes a coding parameterwhich the decoder 200 refers to in order to decode the one or moreslices.

As illustrated in (c) of FIG. 2 , a slice includes a slice header andone or more bricks. A slice header includes a coding parameter which thedecoder 200 refers to in order to decode the one or more bricks.

As illustrated in (d) of FIG. 2 , a brick includes one or more codingtree units (CTU).

It is to be noted that a picture may not include any slice and mayinclude a tile group instead of a slice. In this case, the tile groupincludes at least one tile. In addition, a brick may include a slice.

A CTU is also referred to as a super block or a basis splitting unit. Asillustrated in (e) of FIG. 2 , a CTU includes a CTU header and at leastone coding unit (CU). As illustrated, the CTU includes four coding unitsCU(10), CU(11), (CU(12) and CU(13). A CTU header includes a codingparameter which the decoder 200 refers to in order to decode the atleast one CU.

A CU may be split into a plurality of smaller CUs. As shown, CU(10) isnot split into smaller coding units; CU(11) is split into four smallercoding units CU(110), CU(111), CU(112) and CU(113); CU(12) is not splitinto smaller coding units; and CU(13) is split into seven smaller codingunits CU(1310), CU(1311), CU(1312), CU(1313), CU(132), CU(133) andCU(134) As illustrated in (f) of FIG. 2 , a CU includes a CU header,prediction information, and residual coefficient information. Predictioninformation is information for predicting the CU, and the residualcoefficient information is information indicating a prediction residualto be described later. Although a CU is basically the same as aprediction unit (PU) and a transform unit (TU), it is to be noted that,for example, a sub-block transform (SBT) to be described later mayinclude a plurality of TUs smaller than the CU. In addition, the CU maybe processed for each virtual pipeline decoding unit (VPDU) included inthe CU. The VPDU is, for example, a fixed unit which can be processed atone stage when pipeline processing is performed in hardware.

It is to be noted that a stream may not include all of the hierarchicallayers illustrated in FIG. 2 . The order of the hierarchical layers maybe exchanged, or any of the hierarchical layers may be replaced byanother hierarchical layer. Here, a picture which is a target for aprocess which is about to be performed by a device such as encoder 100or decoder 200 is referred to as a current picture. A current picturemeans a current picture to be encoded when the process is an encodingprocess, and a current picture means a current picture to be decodedwhen the process is a decoding process. Likewise, for example, a CU or ablock of CUs which is a target for a process which is about to beperformed by a device such as the encoder 100 or the decoder 200 isreferred to as a current block. A current block means a current block tobe encoded when the process is an encoding process, and a current blockmeans a current block to be decoded when the process is a decodingprocess.

[Picture Structure: Slice/Tile]

A picture may be configured with one or more slice units or one or moretile units to facilitate coding/decoding of the picture in parallel.

Slices are basic coding units included in a picture. A picture mayinclude, for example, one or more slices. In addition, a slice includesone or more coding tree units (CTUs).

FIG. 3 is a conceptual diagram for illustrating one example of a sliceconfiguration. For example, in FIG. 3 a picture includes 11×8 CTUs, andis split into four slices (slices 1 to 4). Slice 1 includes sixteenCTUs, slice 2 includes twenty-one CTUs, slice 3 includes twenty-nineCTUs, and slice 4 includes twenty-two CTUs. Here, each CTU in thepicture belongs to one of the slices. The shape of each slice is a shapeobtained by splitting the picture horizontally. A boundary of each slicedoes not need to coincide with an image end, and may coincide with anyof the boundaries between CTUs in the image. The processing order of theCTUs in a slice (an encoding order or a decoding order) is, for example,a raster-scan order. A slice includes a slice header and encoded data.Features of the slice may be written in the slice header. The featuresmay include a CTU address of a top CTU in the slice, a slice type, etc.

A tile is a unit of a rectangular region included in a picture. Tiles ofa picture may be assigned with a number referred to as TileId inraster-scan order.

FIG. 4 is a conceptual diagram for illustrating one example of a tileconfiguration. For example, in FIG. 4 a picture includes 11×8 CTUs, andis split into four tiles of rectangular regions (tiles 1 to 4). Whentiles are used, the processing order of CTUs may be different from theprocessing order in the case where tiles are not used. When no tile isused, a plurality of CTUs in a picture generally are processed inraster-scan order. When a plurality of tiles are used, at least one CTUin each of the plurality of tiles is processed in raster-scan order. Forexample, as illustrated in FIG. 4 the processing order of the CTUsincluded in tile 1 from the left-end of the first column of tile 1toward the right-end of the first column of tile 1 and then continuesfrom the left-end of the second column of tile 1 toward the right-end ofthe second column of tile 1.

It is to be noted that the one tile may include one or more slices, andone slice may include one or more tiles.

It is to be noted that the picture may be configured with one or moretile sets. A tile set may include one or more tile groups, or one ormore tiles. A picture may be configured with one of a tile set, a tilegroup, and a tile. For example, an order for scanning a plurality oftiles for each tile set in raster scan order is assumed to be a basicencoding order of tiles. A set of one or more tiles which are continuousin the basic encoding order in each tile set is assumed to be a tilegroup. Such a picture may be configured by splitter 102 (see FIG. 7 ) tobe described later.

[Scalable Encoding]

FIGS. 5 and 6 are conceptual diagrams illustrating examples of scalablestream structures, and will be described for convenience with referenceto FIG. 1 .

As illustrated in FIG. 5 , encoder 100 may generate atemporally/spatially scalable stream by dividing each of a plurality ofpictures into any of a plurality of layers and encoding the picture inthe layer. For example, encoder 100 encodes the picture for each layer,thereby achieving scalability where an enhancement layer is presentabove a base layer. Such encoding of each picture is also referred to asscalable encoding. In this way, decoder 200 is capable of switchingimage quality of an image which is displayed by decoding the stream. Inother words, decoder 200 may determine which layer to decode based oninternal factors such as the processing ability of decoder 200 andexternal factors such as a state of a communication bandwidth. As aresult, decoder 200 is capable of decoding a content while freelyswitching between low resolution and high resolution. For example, theuser of the stream watches a video of the stream halfway using asmartphone on the way to home, and continues watching the video at homeon a device such as a TV connected to the Internet. It is to be notedthat each of the smartphone and the device described above includesdecoder 200 having the same or different performances. In this case,when the device decodes layers up to the higher layer in the stream, theuser can watch the video at high quality at home. In this way, encoder100 does not need to generate a plurality of streams having differentimage qualities of the same content, and thus the processing load can bereduced.

Furthermore, the enhancement layer may include meta information based onstatistical information on the image. Decoder 200 may generate a videowhose image quality has been enhanced by performing super-resolutionimaging on a picture in the base layer based on the metadata.Super-resolution imaging may include, for example, improvement in the SNratio in the same resolution, an increase in resolution, etc. Metadatamay include, for example, information for identifying a linear or anon-linear filter coefficient, as used in a super-resolution process, orinformation identifying a parameter value in a filter process, machinelearning, or a least squares method used in super-resolution processing,etc.

In an embodiment, a configuration may be provided in which a picture isdivided into, for example, tiles in accordance with, for example, themeaning of an object in the picture. In this case, decoder 200 maydecode only a partial region in a picture by selecting a tile to bedecoded. In addition, an attribute of the object (person, car, ball,etc.) and a position of the object in the picture (coordinates inidentical images) may be stored as metadata. In this case, decoder 200is capable of identifying the position of a desired object based on themetadata, and determining the tile including the object. For example, asillustrated in FIG. 6 , the metadata may be stored using a data storagestructure different from image data, such as an SEI (supplementalenhancement information) message in HEVC. This metadata indicates, forexample, the position, size, or color of the main object.

Metadata may be stored in units of a plurality of pictures, such as astream, a sequence, or a random access unit. In this way, decoder 200 iscapable of obtaining, for example, the time at which a specific personappears in the video, and by fitting the time information with pictureunit information, is capable of identifying a picture in which theobject (person) is present and determining the position of the object inthe picture.

[Encoder]

An encoder according to an embodiment will be described. FIG. 7 is ablock diagram illustrating a functional configuration of encoder 100according to the embodiment. Encoder 100 is a video encoder whichencodes a video in units of a block.

As illustrated in FIG. 7 , encoder 100 is an apparatus which encodes animage in units of a block, and includes splitter 102, subtractor 104,transformer 106, quantizer 108, entropy encoder 110, inverse quantizer112, inverse transformer 114, adder 116, block memory 118, loop filter120, frame memory 122, intra predictor 124, inter predictor 126,prediction controller 128, and prediction parameter generator 130. Asillustrated, intra predictor 124 and inter predictor 126 are part of aprediction controller.

Encoder 100 is implemented as, for example, a generic processor andmemory. In this case, when a software program stored in the memory isexecuted by the processor, the processor functions as splitter 102,subtractor 104, transformer 106, quantizer 108, entropy encoder 110,inverse quantizer 112, inverse transformer 114, adder 116, loop filter120, intra predictor 124, inter predictor 126, and prediction controller128. Alternatively, encoder 100 may be implemented as one or morededicated electronic circuits corresponding to splitter 102, subtractor104, transformer 106, quantizer 108, entropy encoder 110, inversequantizer 112, inverse transformer 114, adder 116, loop filter 120,intra predictor 124, inter predictor 126, and prediction controller 128.

[Mounting Example of Encoder]

FIG. 8 is a functional block diagram illustrating a mounting example ofan encoder 100. Encoder 100 includes processor a1 and memory a2. Forexample, the plurality of constituent elements of encoder 100illustrated in FIG. 7 are mounted on processor a1 and memory a2illustrated in FIG. 8 .

Processor a1 is circuitry which performs information processing and iscoupled to memory a2. For example, processor a1 is dedicated or generalelectronic circuitry which encodes an image. Processor a1 may be aprocessor such as a CPU. In addition, processor a1 may be an aggregateof a plurality of electronic circuits. In addition, for example,processor a1 may take the roles of two or more constituent elements outof the plurality of constituent elements of encoder 100 illustrated inFIG. 7 , etc.

Memory a2 is dedicated or general memory for storing information that isused by processor a1 to encode the image. Memory a2 may be electroniccircuitry, and may be connected to processor a1. In addition, memory a2may be included in processor a1. In addition, memory a2 may be anaggregate of a plurality of electronic circuits. In addition, memory a2may be a magnetic disc, an optical disc, or the like, or may berepresented as a storage, a recording medium, or the like. In addition,memory a2 may be non-volatile memory, or volatile memory.

For example, memory a2 may store an image to be encoded or a bitstreamcorresponding to an encoded image. In addition, memory a2 may store aprogram for causing processor a1 to encode an image.

In addition, for example, memory a2 may take the roles of two or moreconstituent elements for storing information out of the plurality ofconstituent elements of encoder 100 illustrated in FIG. 7 , etc. Forexample, memory a2 may take the roles of block memory 118 and framememory 122 illustrated in FIG. 7 . More specifically, memory a2 maystore a reconstructed block, a reconstructed picture, etc.

It is to be noted that, in encoder 100, all of the plurality ofconstituent elements indicated in FIG. 7 , etc. may not be implemented,and all the processes described herein may not be performed. Part of theconstituent elements indicated in FIG. 7 , etc. may be included inanother device, or part of the processes described herein may beperformed by another device.

Hereinafter, an overall flow of processes performed by encoder 100 isdescribed, and then each of constituent elements included in encoder 100will be described.

[Overall Flow of Encoding Process].

FIG. 9 is a flow chart indicating one example of an overall encodingprocess performed by encoder 100, and for convenience will be describedwith reference to FIG. 7 .

First, splitter 102 of encoder 100 splits each of the pictures includedin an input image into a plurality of blocks having a fixed size (e.g.,128×128 pixels) (Step Sa_1). Splitter 102 then selects a splittingpattern for the fixed-size block (also referred to as a block shape)(Step Sa_2). In other words, splitter 102 further splits the fixed-sizeblock into a plurality of blocks which form the selected splittingpattern. Encoder 100 performs, for each of the plurality of blocks,Steps Sa_3 to Sa_9 for the block (that is a current block to beencoded).

Prediction controller 128 and prediction executor (which includes intrapredictor 124 and inter predictor 126) generate a prediction image of acurrent block (Step Sa-3). The prediction image may also be referred toas a prediction signal, a prediction block, or prediction samples.

Next, subtractor 104 generates a difference between the current blockand a prediction image as a prediction residual (Step Sa_4). Theprediction residual may also be referred to as a prediction error.

Next, transformer 106 transforms the prediction image and quantizer 108quantizes the result, to generate a plurality of quantized coefficients(Step Sa_5). The plurality of quantized coefficients may sometimes bereferred to as a coefficient block.

Next, entropy encoder 110 encodes (specifically, entropy encodes) theplurality of quantized coefficients and a prediction parameter relatedto generation of a prediction image, to generate a stream (Step Sa_6).The stream may sometimes be referred to as an encoded bitstream or acompressed bitstream.

Next, inverse quantizer 112 performs inverse quantization of theplurality of quantized coefficients and inverse transformer 114 performsinverse transformation of the result, to restore a prediction residual(Step Sa_7).

Next, adder 116 adds the prediction image to the restored predictionresidual to reconstruct the current block (Step Sa_8). In this way, thereconstructed image is generated. The reconstructed image may also bereferred to as a reconstructed block or a decoded image block.

When the reconstructed image is generated, loop filter 120 performsfiltering of the reconstructed image as necessary (Step Sa_9).

Encoder 100 then determines whether encoding of the entire picture hasbeen finished (Step Sa_10). When determining that the encoding has notyet been finished (No in Step Sa_10), execution of processes from StepSa_2 are repeated for the next block of the picture.

Although encoder 100 selects one splitting pattern for a fixed-sizeblock, and encodes each block according to the splitting pattern in theabove-described example, it is to be noted that each block may beencoded according to a corresponding one of a plurality of splittingpatterns. In this case, encoder 100 may evaluate a cost for each of theplurality of splitting patterns, and, for example, may select the streamobtainable by encoding according to the splitting pattern which yieldsthe smallest cost as a stream which is output.

As illustrated, the processes in Steps Sa_1 to Sa_10 are performedsequentially by encoder 100. Alternatively, two or more of the processesmay be performed in parallel, the processes may be reordered, etc.

The encoding process employed by encoder 100 is a hybrid encoding usingprediction encoding and transform encoding. In addition, predictionencoding is performed by an encoding loop configured with subtractor104, transformer 106, quantizer 108, inverse quantizer 112, inversetransformer 114, adder 116, loop filter 120, block memory 118, framememory 122, intra predictor 124, inter predictor 126, and predictioncontroller 128. In other words, the prediction executor configured withintra predictor 124 and inter predictor 126 is part of the encodingloop.

[Splitter]

Splitter 102 splits each picture included in the original image into aplurality of blocks, and outputs each block to subtractor 104. Forexample, splitter 102 first splits a picture into blocks of a fixed size(for example, 128×128 pixels). Other fixed block sizes may be employed.The fixed-size block is also referred to as a coding tree unit (CTU).Splitter 102 then splits each fixed-size block into blocks of variablesizes (for example, 64×64 pixels or smaller), based on recursivequadtree and/or binary tree block splitting. In other words, splitter102 selects a splitting pattern. The variable-size block also may bereferred to as a coding unit (CU), a prediction unit (PU), or atransform unit (TU). It is to be noted that, in various kinds ofprocessing examples, there is no need to differentiate between CU, PU,and TU; all or some of the blocks in a picture may be processed in unitsof a CU, a PU, or a TU.

FIG. 10 is a conceptual diagram for illustrating one example of blocksplitting according to an embodiment. In FIG. 10 , the solid linesrepresent block boundaries of blocks split by quadtree block splitting,and the dashed lines represent block boundaries of blocks split bybinary tree block splitting.

Here, block 10 is a square block having 128×128 pixels (128×128 block).This 128×128 block 10 is first split into four square 64×64 pixel blocks(quadtree block splitting).

The upper-left 64×64 pixel block is further vertically split into tworectangular 32×64 pixel blocks, and the left 32×64 pixel block isfurther vertically split into two rectangular 16×64 pixel blocks (binarytree block splitting). As a result, the upper-left 64×64 pixel block issplit into two 16×64 pixel blocks 11 and 12 and one 32×64 pixel block13.

The upper-right 64×64 pixel block is horizontally split into tworectangular 64×32 pixel blocks 14 and 15 (binary tree block splitting).

The lower-left square 64×64 pixel block is first split into four square32×32 pixel blocks (quadtree block splitting). The upper-left block andthe lower-right block among the four square 32×32 pixel blocks arefurther split. The upper-left square 32×32 pixel block is verticallysplit into two rectangle 16×32 pixel blocks, and the right 16×32 pixelblock is further horizontally split into two 16×16 pixel blocks (binarytree block splitting). The lower-right 32×32 pixel block is horizontallysplit into two 32×16 pixel blocks (binary tree block splitting). Theupper-right square 32×32 pixel block is horizontally split into tworectangle 32×16 pixel blocks (binary tree block splitting). As a result,the lower-left square 64×64 pixel block is split into rectangle 16×32pixel block 16, two square 16×16 pixel blocks 17 and 18, two square32×32 pixel blocks 19 and 20, and two rectangle 32×16 pixel blocks 21and 22.

The lower-right 64×64 pixel block 23 is not split.

As described above, in FIG. 10 , block 10 is split into thirteenvariable-size blocks 11 through 23 based on recursive quadtree andbinary tree block splitting. This type of splitting is also referred toas quadtree plus binary tree (QTBT) splitting.

It is to be noted that, in FIG. 10 , one block is split into four or twoblocks (quadtree or binary tree block splitting), but splitting is notlimited to these examples. For example, one block may be split intothree blocks (ternary block splitting). Splitting including such ternaryblock splitting is also referred to as multi-type tree (MBT) splitting.

FIG. 11 is a block diagram illustrating one example of a functionalconfiguration of splitter 102 according to one embodiment. Asillustrated in FIG. 11 , splitter 102 may include block splittingdeterminer 102 a. Block splitting determiner 102 a may perform thefollowing processes as examples.

For example, block splitting determiner 102 a may obtain or retrieveblock information from block memory 118 and/or frame memory 122, anddetermine a splitting pattern (e.g., the above-described splittingpattern) based on the block information. Splitter 102 splits theoriginal image according to the splitting pattern, and outputs at leastone block obtained by the splitting to subtractor 104.

In addition, for example, block splitting determiner 102 a outputs oneor more parameters indicating the determined splitting pattern (e.g.,the above-described splitting pattern) to transformer 106, inversetransformer 114, intra predictor 124, inter predictor 126, and entropyencoder 110. Transformer 106 may transform a prediction residual basedon the one or more parameters. Intra predictor 124 and inter predictor126 may generate a prediction image based on the one or more parameters.In addition, entropy encoder 110 may entropy encode the one or moreparameters.

The parameter related to the splitting pattern may be written in astream as indicated below as one example.

FIG. 12 is a conceptual diagram for illustrating examples of splittingpatterns. Examples of splitting patterns include: splitting into fourregions (QT) in which a block is split into two regions bothhorizontally and vertically; splitting into three regions (HT or VT) inwhich a block is split in the same direction in a ratio of 1:2:1;splitting into two regions (HB or VB) in which a block is split in thesame direction in a ratio of 1:1; and no splitting (NS).

It is to be noted that the splitting pattern does not have a blocksplitting direction in the case of splitting into four regions and nosplitting, and that the splitting pattern has splitting directioninformation in the case of splitting into two regions or three regions.

FIG. 13A is a conceptual diagram for illustrating one example of asyntax tree of a splitting pattern.

FIG. 13B is a conceptual diagram for illustrating another example of asyntax tree of a splitting pattern.

FIGS. 13A and 13B are conceptual diagrams for illustrating examples of asyntax tree of a splitting pattern. In the example of FIG. 13A, first,information indicating whether to perform splitting (S: Split flag) ispresent, and information indicating whether to perform splitting intofour regions (QT: QT flag) is present next. Information indicating whichone of splitting into three regions and two regions is to be performed(TT: TT flag or BT: BT flag) is present next, and information indicatinga division direction (Ver: Vertical flag or Hor: Horizontal flag) isthen present. It is to be noted that each of at least one block obtainedby splitting according to such a splitting pattern may be further splitrepeatedly in a similar process. In other words, as one example, whethersplitting is performed, whether splitting into four regions isperformed, which one of the horizontal direction and the verticaldirection is the direction in which a splitting method is to beperformed, which one of splitting into three regions and splitting intotwo regions is to be performed may be recursively determined, and thedetermination results may be encoded in a stream according to theencoding order disclosed by the syntax tree illustrated in FIG. 13A.

In addition, although information items respectively indicating S, QT,TT, and Ver are arranged in the listed order in the syntax treeillustrated in FIG. 13A, information items respectively indicating S,QT, Ver, and BT may be arranged in the listed order. In other words, inthe example of FIG. 13B, first, information indicating whether toperform splitting (S: Split flag) is present, and information indicatingwhether to perform splitting into four regions (QT: QT flag) is presentnext. Information indicating the splitting direction (Ver: Vertical flagor Hor: Horizontal flag) is present next, and information indicatingwhich one of splitting into two regions and splitting into three regionsis to be performed (BT: BT flag or TT: TT flag) is then present.

It is to be noted that the splitting patterns described above areexamples, and splitting patterns other than the described splittingpatterns may be used, or part of the described splitting patterns may beused.

[Subtractor]

Subtractor 104 subtracts a prediction image (prediction sample that isinput from prediction controller 128 indicated below) from an originalimage in units of a block input from splitter 102 and split by splitter102. In other words, subtractor 104 calculates prediction residuals(also referred to as errors) of a current block. Subtractor 104 thenoutputs the calculated prediction residuals to transformer 106.

The original image may be an image which has been input into encoder 100as a signal representing an image of each picture included in a video(for example, a luma signal and two chroma signals). A signalrepresenting an image also may be referred to as a sample.

[Transformer]

Transformer 106 transforms prediction residuals in a spatial domain intotransform coefficients in a frequency domain, and outputs the transformcoefficients to quantizer 108. More specifically, transformer 106applies, for example, a defined discrete cosine transform (DCT) ordiscrete sine transform (DST) to prediction residuals in a spatialdomain. The defined DCT or DST may be predefined.

It is to be noted that transformer 106 may adaptively select a transformtype from among a plurality of transform types, and transform predictionresiduals into transform coefficients by using a transform basisfunction corresponding to the selected transform type. This sort oftransform is also referred to as explicit multiple core transform (EMT)or adaptive multiple transform (AMT). A transform basis function mayalso be referred to as a basis.

The transform types include, for example, DCT-II, DCT-V, DCT-VIII,DST-I, and DST-VII. It is noted that these transform types may berepresented as DCT2, DCT5, DCT8, DST1 and DST7. FIG. 14 is a chartindicating example transform basis functions for the example transformtypes. In FIG. 14 , N indicates the number of input pixels. For example,selection of a transform type from among the plurality of transformtypes may depend on a prediction type (one of intra prediction and interprediction), and may depend on an intra prediction mode.

Information indicating whether to apply such EMT or AMT (referred to as,for example, an EMT flag or an AMT flag) and information indicating theselected transform type is normally signaled at the CU level. It is tobe noted that the signaling of such information does not necessarilyneed to be performed at the CU level, and may be performed at anotherlevel (for example, at the sequence level, picture level, slice level,tile level, or CTU level).

In addition, transformer 106 may re-transform the transform coefficients(which are transform results). Such re-transform is also referred to asadaptive secondary transform (AST) or non-separable secondary transform(NSST). For example, transformer 106 performs re-transform in units of asub-block (for example, 4×4 pixel sub-block) included in a transformcoefficient block corresponding to an intra prediction residual.Information indicating whether to apply NSST and information related toa transform matrix for use in NSST are normally signaled at the CUlevel. It is to be noted that the signaling of such information does notnecessarily need to be performed at the CU level, and may be performedat another level (for example, at the sequence level, picture level,slice level, tile level, or CTU level).

Transformer 106 may employ a separable transform and a non-separabletransform. A separable transform is a method in which a transform isperformed a plurality of times by separately performing a transform foreach of a number of directions according to the number of dimensions ofinputs. A non-separable transform is a method of performing a collectivetransform in which two or more dimensions in multidimensional inputs arecollectively regarded as a single dimension.

In one example of a non-separable transform, when an input is a 4×4pixel block, the 4×4 pixel block is regarded as a single array includingsixteen elements, and the transform applies a 16×16 transform matrix tothe array.

In another example of a non-separable transform, an input block of 4×4pixels is regarded as a single array including sixteen elements, andthen a transform (hypercube givens transform) in which givens revolutionis performed on the array a plurality of times may be performed.

In the transform in transformer 106, the transform types of transformbases functions to be transformed into the frequency domain according toregions in a CU can be switched. Examples include a spatially varyingtransform (SVT).

FIG. 15 is a conceptual diagram for illustrating one example of an SVT.

In SVT, as illustrated in FIG. 15 , CUs are split into two equal regionshorizontally or vertically, and only one of the regions is transformedinto the frequency domain. A transform basis type can be set for eachregion. For example, DST7 and DST8 are used. For example, among the tworegions obtained by splitting a CU vertically into two equal regions,DST7 and DCT8 may be used for the region at position 0. Alternatively,among the two regions, DST7 is used for the region at position 1.Likewise, among the two regions obtained by splitting a CU horizontallyinto two equal regions, DST7 and DCT8 are used for the region atposition 0. Alternatively, among the two regions, DST7 is used for theregion at position 1. Although only one of the two regions in a CU istransformed and the other is not transformed in the example illustratedin FIG. 15 , each of the two regions may be transformed. In addition, asplitting method may include not only splitting into two regions butalso splitting into four regions. In addition, the splitting method canbe more flexible. For example, information indicating the splittingmethod may be encoded and may be signaled in the same manner as the CUsplitting. It is to be noted that SVT also may be referred to assub-block transform (SBT).

The AMT and EMT described above may be referred to as MTS (multipletransform selection). When MTS is applied, a transform type that isDST7, DCT8, or the like can be selected, and the information indicatingthe selected transform type may be encoded as index information for eachCU. There is another process referred to as IMTS (implicit MTS) as aprocess for selecting a transform type to be used for orthogonaltransform performed without encoding index information. When IMTS isapplied, for example, when a CU has a rectangle shape, orthogonaltransform of the rectangle shape may be performed using DST7 for theshort side and DST2 for the long side. In addition, for example, when aCU has a square shape, orthogonal transform of the rectangle shape maybe performed using DCT2 when MTS is effective in a sequence and usingDST7 when MTS is ineffective in the sequence. DCT2 and DST7 are mereexamples. Other transform types may be used, and it is also possible tochange the combination of transform types for use to a differentcombination of transform types. IMTS may be used only for intraprediction blocks, or may be used for both intra prediction blocks andinter prediction block.

The three processes of MTS, SBT, and IMTS have been described above asselection processes for selectively switching transform types for use inorthogonal transform. However, all of the three selection processes maybe employed, or only part of the selection processes may be selectivelyemployed. Whether one or more of the selection processes is employed maybe identified, for example, based on flag information or the like in aheader such as an SPS. For example, when all of the three selectionprocesses are available for use, one of the three selection processes isselected for each CU and orthogonal transform of the CU is performed. Itis to be noted that the selection processes for selectively switchingthe transform types may be selection processes different from the abovethree selection processes, or each of the three selection processes maybe replaced by another process. Typically, at least one of the followingfour transfer functions [1] to [4] is performed. Function [1] is afunction for performing orthogonal transform of the entire CU andencoding information indicating the transform type used in thetransform. Function [2] is a function for performing orthogonaltransform of the entire CU and determining the transform type based on adetermined rule without encoding information indicating the transformtype. Function [3] is a function for performing orthogonal transform ofa partial region of a CU and encoding information indicating thetransform type used in the transform. Function [4] is a function forperforming orthogonal transform of a partial region of a CU anddetermining the transform type based on a determined rule withoutencoding information indicating the transform type used in thetransform. The determined rules may be predetermined.

It is to be noted that whether MTS, IMTS, and/or SBT is applied may bedetermined for each processing unit. For example, whether MTS, IMTS,and/or SBT is applied may be determined for each sequence, picture,brick, slice, CTU, or CU.

It is to be noted that a tool for selectively switching transform typesin the present disclosure may be described as a method for selectivelyselecting a basis for use in a transform process, a selection process,or a process for selecting a basis. In addition, the tool forselectively switching transform types may be described as a mode foradaptively selecting transform types.

FIG. 16 is a flow chart illustrating one example of a process performedby transformer 106, and will be described for convenience with referenceto FIG. 7 . For example, transformer 106 determines whether to performorthogonal transform (Step St_1). Here, when determining to performorthogonal transform (Yes in Step St_1), transformer 106 selects atransform type for use in orthogonal transform from a plurality oftransform types (Step St_2). Next, transformer 106 performs orthogonaltransform by applying the selected transform type to the predictionresidual of a current block (Step St_3). Transformer 106 then outputsinformation indicating the selected transform type to entropy encoder110, so as to allow entropy encoder 110 to encode the information (StepSt_4). On the other hand, when determining not to perform orthogonaltransform (No in Step St_1), transformer 106 outputs informationindicating that no orthogonal transform is performed, so as to allowentropy encoder 110 to encode the information (Step St_5). It is to benoted that whether to perform orthogonal transform in Step St_1 may bedetermined based on, for example, the size of a transform block, aprediction mode applied to the CU, etc. Alternatively, orthogonaltransform may be performed using a defined transform type withoutencoding information indicating the transform type for use in orthogonaltransform. The defined transform type may be predefined.

FIG. 17 is a flow chart illustrating one example of a process performedby transformer 106, and will be described for convenience with referenceto FIG. 7 . It is to be noted that the example illustrated in FIG. 17 isan example of orthogonal transform in the case where transform types foruse in orthogonal transform are selectively switched as in the case ofthe example illustrated in FIG. 16 .

As one example, a first transform type group may include DCT2, DST7, andDCT8. As another example, a second transform type group may includeDCT2. The transform types included in the first transform type group andthe transform types included in the second transform type group maypartly overlap with each other, or may be totally different from eachother.

Transformer 106 determines whether a transform size is smaller than orequal to a determined value (Step Su_1). Here, when determining that thetransform size is smaller than or equal to the determined value (Yes inStep Su_1), transformer 106 performs orthogonal transform of theprediction residual of the current block using the transform typeincluded in the first transform type group (Step Su_2). Next,transformer 106 outputs information indicating the transform type to beused among at least one transform type included in the first transformtype group to entropy encoder 110, so as to allow entropy encoder 110 toencode the information (Step Su_3). On the other hand, when determiningthat the transform size is not smaller than or equal to the determinedvalue (No in Step Su_1), transformer 106 performs orthogonal transformof the prediction residual of the current block using the secondtransform type group (Step Su_4). The determined value may be athreshold value, and may be a predetermined value.

In Step Su_3, the information indicating the transform type for use inorthogonal transform may be information indicating a combination of thetransform type to be applied vertically in the current block and thetransform type to be applied horizontally in the current block. Thefirst type group may include only one transform type, and theinformation indicating the transform type for use in orthogonaltransform may not be encoded. The second transform type group mayinclude a plurality of transform types, and information indicating thetransform type for use in orthogonal transform among the one or moretransform types included in the second transform type group may beencoded.

Alternatively, a transform type may be indicated based on a transformsize without encoding information indicating the transform type. It isto be noted that such determinations are not limited to thedetermination as to whether the transform size is smaller than or equalto the determined value, and other processes are also possible fordetermining a transform type for use in orthogonal transform based onthe transform size.

[Quantizer]

Quantizer 108 quantizes the transform coefficients output fromtransformer 106. More specifically, quantizer 108 scans, in a determinedscanning order, the transform coefficients of the current block, andquantizes the scanned transform coefficients based on quantizationparameters (QP) corresponding to the transform coefficients. Quantizer108 then outputs the quantized transform coefficients (hereinafter alsoreferred to as quantized coefficients) of the current block to entropyencoder 110 and inverse quantizer 112. The determined scanning order maybe predetermined.

A determined scanning order is an order for quantizing/inversequantizing transform coefficients. For example, a determined scanningorder may be defined as ascending order of frequency (from low to highfrequency) or descending order of frequency (from high to lowfrequency).

A quantization parameter (QP) is a parameter defining a quantizationstep (quantization width). For example, when the value of thequantization parameter increases, the quantization step also increases.In other words, when the value of the quantization parameter increases,the error in quantized coefficients (quantization error) increases.

In addition, a quantization matrix may be used for quantization. Forexample, several kinds of quantization matrices may be usedcorrespondingly to frequency transform sizes such as 4×4 and 8×8,prediction modes such as intra prediction and inter prediction, andpixel components such as luma and chroma pixel components. It is to benoted that quantization means digitalizing values sampled at determinedintervals correspondingly to determined levels. In this technical field,quantization may be referred to using other expressions, such asrounding and scaling, and may employ rounding and scaling. Thedetermined intervals and determined levels may be predetermined.

Methods using quantization matrices may include a method using aquantization matrix which has been set directly at the encoder 100 side,and a method using a quantization matrix which has been set as a default(default matrix). At the encoder 100 side, a quantization matrixsuitable for features of an image can be set by directly setting aquantization matrix. This case, however, may have a disadvantage ofincreasing a coding amount for encoding the quantization matrix. It isto be noted that a quantization matrix to be used to quantize thecurrent block may be generated based on a default quantization matrix oran encoded quantization matrix, instead of directly using the defaultquantization matrix or the encoded quantization matrix.

There is a method for quantizing a high-frequency coefficient and alow-frequency coefficient without using a quantization matrix. It is tobe noted that this method may be viewed as equivalent to a method usinga quantization matrix (flat matrix) whose coefficients have the samevalue.

The quantization matrix may be encoded, for example, at the sequencelevel, picture level, slice level, brick level, or CTU level. Thequantization matrix may be specified using, for example, a sequenceparameter set (SPS) or a picture parameter set (PPS). The SPS includes aparameter which is used for a sequence, and the PPS includes a parameterwhich is used for a picture. Each of the SPS and the PPS may be simplyreferred to as a parameter set.

When using a quantization matrix, quantizer 108 scales, for eachtransform coefficient, for example a quantization width which can becalculated based on a quantization parameter, etc., using the value ofthe quantization matrix. The quantization process performed withoutusing a quantization matrix may be a process for quantizing transformcoefficients based on the quantization width calculated based on thequantization parameter, etc. It is to be noted that, in the quantizationprocess performed without using any quantization matrix, thequantization width may be multiplied by a determined value which iscommon for all the transform coefficients in a block. The determinedvalue may be predetermined.

FIG. 18 is a block diagram illustrating one example of a functionalconfiguration of a quantizer according to an embodiment. For example,quantizer 108 includes difference quantization parameter generator 108a, predicted quantization parameter generator 108 b, quantizationparameter generator 108 c, quantization parameter storage 108 d, andquantization executor 108 e.

FIG. 19 is a flow chart illustrating one example of a quantizationprocess performed by quantizer 108, and will be described forconvenience with reference to FIGS. 7 and 18 .

As one example, quantizer 108 may perform quantization for each CU basedon the flow chart illustrated in FIG. 19 . More specifically,quantization parameter generator 108 c determines whether to performquantization (Step Sv_1). Here, when determining to perform quantization(Yes in Step Sv_1), quantization parameter generator 108 c generates aquantization parameter for a current block (Step Sv_2), and stores thequantization parameter to quantization parameter storage 108 d (StepSv_3).

Next, quantization executor 108 e quantizes transform coefficients ofthe current block using the quantization parameter generated in StepSv_2 (Step Sv_4). Predicted quantization parameter generator 108 b thenobtains a quantization parameter for a processing unit different fromthe current block from quantization parameter storage 108 d (Step Sv_5).Predicted quantization parameter generator 108 b generates a predictedquantization parameter of the current block based on the obtainedquantization parameter (Step Sv_6). Difference quantization parametergenerator 108 a calculates the difference between the quantizationparameter of the current block generated by quantization parametergenerator 108 c and the predicted quantization parameter of the currentblock generated by predicted quantization parameter generator 108 b(Step Sv_7). The difference quantization parameter may be generated bycalculating the difference. Difference quantization parameter generator108 a outputs the difference quantization parameter to entropy encoder110, so as to allow entropy encoder 110 to encode the differencequantization parameter (Step Sv_8).

It is to be noted that the difference quantization parameter may beencoded, for example, at the sequence level, picture level, slice level,brick level, or CTU level. In addition, an initial value of thequantization parameter may be encoded at the sequence level, picturelevel, slice level, brick level, or CTU level. At initialization, thequantization parameter may be generated using the initial value of thequantization parameter and the difference quantization parameter.

It is to be noted that quantizer 108 may include a plurality ofquantizers, and may apply dependent quantization in which transformcoefficients are quantized using a quantization method selected from aplurality of quantization methods.

[Entropy Encoder]

FIG. 20 is a block diagram illustrating one example of a functionalconfiguration of entropy encoder 110 according to an embodiment, andwill be described for convenience with reference to FIG. 7 . Entropyencoder 110 generates a stream by entropy encoding the quantizedcoefficients input from quantizer 108 and a prediction parameter inputfrom prediction parameter generator 130. For example, context-basedadaptive binary arithmetic coding (CABAC) is used as the entropyencoding. More specifically, entropy encoder 110 as illustrated includesbinarizer 110 a, context controller 110 b, and binary arithmetic encoder110 c. Binarizer 110 a performs binarization in which multi-levelsignals such as quantized coefficients and a prediction parameter aretransformed into binary signals. Examples of binarization methodsinclude truncated Rice binarization, exponential Golomb codes, and fixedlength binarization. Context controller 110 b derives a context valueaccording to a feature or a surrounding state of a syntax element, thatis an occurrence probability of a binary signal. Examples of methods forderiving a context value include bypass, referring to a syntax element,referring to an upper and left adjacent blocks, referring tohierarchical information, etc. Binary arithmetic encoder 110 carithmetically encodes the binary signal using the derived context.

FIG. 21 is a conceptual diagram for illustrating an example flow of aCABAC process in the entropy encoder 110. First, initialization isperformed in CABAC in entropy encoder 110. In the initialization,initialization in binary arithmetic encoder 110 c and setting of aninitial context value are performed. For example, binarizer 110 a andbinary arithmetic encoder 110 c may execute binarization and arithmeticencoding of the plurality of quantization coefficients in a CTUsequentially. Context controller 110 b may update the context value eachtime arithmetic encoding is performed. Context controller 110 b may thensave the context value as a post process. The saved context value may beused, for example, to initialize the context value for the next CTU.

[Inverse Quantizer]

Inverse quantizer 112 inverse quantizes quantized coefficients whichhave been input from quantizer 108. More specifically, inverse quantizer112 inverse quantizes, in a determined scanning order, quantizedcoefficients of the current block. Inverse quantizer 112 then outputsthe inverse quantized transform coefficients of the current block toinverse transformer 114. The determined scanning order may bepredetermined.

[Inverse Transformer]

Inverse transformer 114 restores prediction residuals by inversetransforming transform coefficients which have been input from inversequantizer 112. More specifically, inverse transformer 114 restores theprediction residuals of the current block by performing an inversetransform corresponding to the transform applied to the transformcoefficients by the transformer 106. Inverse transformer 114 thenoutputs the restored prediction residuals to adder 116.

It is to be noted that since information is normally lost inquantization, the restored prediction residuals do not match theprediction residuals calculated by subtractor 104. In other words, therestored prediction residuals normally include quantization errors.

[Adder]

Adder 116 reconstructs the current block by adding the predictionresiduals which have been input from inverse transformer 114 andprediction images which have been input from prediction controller 128.Consequently, a reconstructed image is generated. Adder 116 then outputsthe reconstructed image to block memory 118 and loop filter 120. Areconstructed block may also be referred to as a local decoded block.

[Block Memory]

Block memory 118 is storage for storing blocks in a current picture, forexample, for use in intra prediction. More specifically, block memory118 stores reconstructed images output from adder 116.

[Frame Memory]

Frame memory 122 is, for example, storage for storing reference picturesfor use in inter prediction, and is also referred to as a frame buffer.More specifically, frame memory 122 stores reconstructed images filteredby loop filter 120.

[Loop Filter]

Loop filter 120 applies a loop filter to a reconstructed image output byadder 116, and outputs the filtered reconstructed image to frame memory122. A loop filter is a filter used in an encoding loop (in-loopfilter). Examples of loop filters include, for example, an adaptive loopfilter (ALF), a deblocking filter (DB or DBF), a sample adaptive offset(SAO) filter, etc.

FIG. 22 is a block diagram illustrating one example of a functionalconfiguration of loop filter 120 according to an embodiment. Forexample, as illustrated in FIG. 22 , loop filter 120 includes deblockingfilter executor 120 a, SAO executor 120 b, and ALF executor 120 c.Deblocking filter executor 120 a performs a deblocking filter process onthe reconstructed image. SAO executor 120 b performs a SAO process onthe reconstructed image after being subjected to the deblocking filterprocess. ALF executor 120 c performs an ALF process on the reconstructedimage after being subjected to the SAO process. The ALF and deblockingfilter are described later in detail. The SAO process is a process forenhancing image quality by reducing ringing (a phenomenon in which pixelvalues are distorted like waves around an edge) and correcting deviationin pixel value. Examples of SAO processes include an edge offset processand a band offset process. It is to be noted that loop filter 120, insome embodiments, may not include all the constituent elements disclosedin FIG. 22 , and may include some of the constituent elements, and mayinclude additional elements. In addition, loop filter 120 may beconfigured to perform the above processes in a processing orderdifferent from the one disclosed in FIG. 22 , may not perform all of theprocesses, etc.

[Loop Filter>Adaptive Loop Filter]

In an ALF, a least square error filter for removing compressionartifacts is applied. For example, one filter selected from among aplurality of filters based on the direction and activity of localgradients is applied for each 2×2 pixel sub-block in the current block.

More specifically, first, each sub-block (for example, each 2×2 pixelsub-block) is categorized into one out of a plurality of classes (forexample, fifteen or twenty-five classes). The classification of thesub-block may be based on, for example, gradient directionality andactivity. In an example, category index C (for example, C=5D+A) iscalculated or determined based on gradient directionality D (forexample, 0 to 2 or 0 to 4) and gradient activity A (for example, 0 to4). Then, based on classification index C, each sub-block is categorizedinto one out of a plurality of classes.

For example, gradient directionality D is calculated by comparinggradients of a plurality of directions (for example, the horizontal,vertical, and two diagonal directions). Moreover, for example, gradientactivity A is calculated by adding gradients of a plurality ofdirections and quantizing the result of addition.

The filter to be used for each sub-block may be determined from amongthe plurality of filters based on the result of such categorization.

The filter shape to be used in an ALF is, for example, a circularsymmetric filter shape. FIG. 23A through FIG. 23C are conceptualdiagrams for illustrating examples of filter shapes used in ALFs. FIG.23A illustrates a 5×5 diamond shape filter, FIG. 23B illustrates a 7×7diamond shape filter, and FIG. 23C illustrates a 9×9 diamond shapefilter. Information indicating the filter shape is normally signaled atthe picture level. It is to be noted that the signaling of suchinformation indicating the filter shape does not necessarily need to beperformed at the picture level, and may be performed at another level(for example, at the sequence level, slice level, tile level, CTU level,or CU level).

The ON or OFF of the ALF may be determined, for example, at the picturelevel or CU level. For example, the decision of whether to apply the ALFto luma may be made at the CU level, and the decision of whether toapply ALF to chroma may be made at the picture level. Informationindicating ON or OFF of the ALF is normally signaled at the picturelevel or CU level. It is to be noted that the signaling of informationindicating ON or OFF of the ALF does not necessarily need to beperformed at the picture level or CU level, and may be performed atanother level (for example, at the sequence level, slice level, tilelevel, or CTU level).

In addition, as described above, one filter is selected from theplurality of filters, and an ALF process of a sub-block is performed. Acoefficient set of coefficients to be used for each of the plurality offilters (for example, up to the fifteenth or twenty-fifth filter) isnormally signaled at the picture level. It is to be noted that thesignaling of the coefficient set does not necessarily need to beperformed at the picture level, and may be performed at another level(for example, at the sequence level, slice level, tile level, CTU level,CU level, or sub-block level).

[Loop Filter>Cross Component Adaptive Loop Filter]

FIG. 23D is a conceptual diagram for illustrating an example flow of across component ALF (CC-ALF). FIG. 23E is a conceptual diagram forillustrating an example of a filter shape used in a CC-ALF, such as theCC-ALF of FIG. 23D. The example CC-ALF of FIGS. 23D and 23E operates byapplying a linear, diamond shaped filter to the luma channel for eachchroma component. The filter coefficients, for example, may betransmitted in the APS, scaled by a factor of 2{umlaut over ( )}10, androunded for fixed point representation. For example, in FIG. 23D, Ysamples (first component) are used for CCALF for Cb and CCALF for Cr(components different from the first component).

The application of the filters may be controlled on a variable blocksize and signaled by a context-coded flag received for each block ofsamples. The block size along with an CC-ALF enabling flag may bereceived at the slice-level for each chroma component. CC-ALF maysupport various block sizes, for example (in chroma samples) 16×16pixels, 32×32 pixels, 64×64 pixels, 128×128 pixels.

[Loop Filter>Joint Chroma Cross Component Adaptive Loop Filter]

One example of Joint Chroma-CCALF, is illustrated in FIGS. 23F and 23G.FIG. 23F is a conceptual diagram for illustrating an example flow of aJoint Chroma CCALF. FIG. 23G is a table illustrating example weightindex candidates. As illustrated, one CCALF filter is used to generateone CCALF filtered output as the chroma refinement signal for one colorcomponent, while a weighted version of the same chroma refinement signalis applied to the other color component. In this way, the complexity ofexisting CCALF is reduced roughly by half. The weight value may be codedinto a sign flag and a weight index. The weight index (denoted asweight_index) may be coded into 3 bits, and specifies the magnitude ofthe JC-CCALF weight JcCcWeight, which is a non-zero magnitude. Themagnitude of JcCcWeight may, for example, be determined as follows:

If weight_index is less than or equal to 4, JcCcWeight is equal toweight_index>>2;

Otherwise, JcCcWeight is equal to 4/(weight_index−4).

The block-level on/off control of ALF filtering for Cb and Cr may beseparate. This is the same as in CCALF, and two separate sets ofblock-level on/off control flags may be coded. Different from CCALF,herein, the Cb, Cr on/off control block sizes are the same, and thus,only one block size variable may be coded.

[Loop Filter>Deblocking Filter]

In a deblocking filter process, loop filter 120 performs a filterprocess on a block boundary in a reconstructed image so as to reducedistortion which occurs at the block boundary.

FIG. 24 is a block diagram illustrating one example of a specificconfiguration of deblocking filter executor 120 a of a loop filter 120(see FIGS. 7 and 22 ) which functions as a deblocking filter.

Deblocking filter executor 120 a includes: boundary determiner 1201;filter determiner 1203; filtering executor 1205; process determiner1208; filter characteristic determiner 1207; and switches 1202, 1204,and 1206.

Boundary determiner 1201 determines whether a pixel to bedeblock-filtered (that is, a current pixel) is present around a blockboundary. Boundary determiner 1201 then outputs the determination resultto switch 1202 and processing determiner 1208.

In the case where boundary determiner 1201 has determined that a currentpixel is present around a block boundary, switch 1202 outputs anunfiltered image to switch 1204. In the opposite case where boundarydeterminer 1201 has determined that no current pixel is present around ablock boundary, switch 1202 outputs an unfiltered image to switch 1206.It is to be noted that the unfiltered image is an image configured witha current pixel and at least one surrounding pixel located around thecurrent pixel.

Filter determiner 1203 determines whether to perform deblockingfiltering of the current pixel, based on the pixel value of at least onesurrounding pixel located around the current pixel. Filter determiner1203 then outputs the determination result to switch 1204 and processdeterminer 1208.

In the case where filter determiner 1203 has determined to performdeblocking filtering of the current pixel, switch 1204 outputs theunfiltered image obtained through switch 1202 to filtering executor1205. In the opposite case where filter determiner 1203 has determinednot to perform deblocking filtering of the current pixel, switch 1204outputs the unfiltered image obtained through switch 1202 to switch1206.

When obtaining the unfiltered image through switches 1202 and 1204,filtering executor 1205 executes, for the current pixel, deblockingfiltering with the filter characteristic determined by filtercharacteristic determiner 1207. Filtering executor 1205 then outputs thefiltered pixel to switch 1206.

Under control by processing determiner 1208, switch 1206 selectivelyoutputs one of a pixel which has not been deblock-filtered and a pixelwhich has been deblock-filtered by filtering executor 1205.

Processing determiner 1208 controls switch 1206 based on the results ofdeterminations made by boundary determiner 1201 and filter determiner1203. In other words, processing determiner 1208 causes switch 1206 tooutput the pixel which has been deblock-filtered when boundarydeterminer 1201 has determined that the current pixel is present aroundthe block boundary and when filter determiner 1203 has determined toperform deblocking filtering of the current pixel. In addition, otherthan the above case, processing determiner 1208 causes switch 1206 tooutput the pixel which has not been deblock-filtered. A filtered imageis output from switch 1206 by repeating output of a pixel in this way.It is to be noted that the configuration illustrated in FIG. 24 is oneexample of a configuration in deblocking filter executor 120 a.Deblocking filter executor 120 a may have various configurations.

FIG. 25 is a conceptual diagram for illustrating an example of adeblocking filter having a symmetrical filtering characteristic withrespect to a block boundary.

In a deblocking filter process, one of two deblocking filters havingdifferent characteristics, that is, a strong filter and a weak filter,may be selected using pixel values and quantization parameters. In thecase of the strong filter, when pixels p0 to p2 and pixels q0 to q2 arepresent across a block boundary as illustrated in FIG. 25 , the pixelvalues of the respective pixel q0 to q2 are changed to pixel values q′0to q′2 by performing, for example, computations according to theexpressions below.q′0=(p1+2×p0+2×q0+2×q1+q2+4)/8q′1=(p0+q0+q1+q2+2)/4q′2=(p0+q0+q1+3×q2+2×q3+4)/8

It is to be noted that, in the above expressions, p0 to p2 and q0 to q2are the pixel values of respective pixels p0 to p2 and pixels q0 to q2.In addition, q3 is the pixel value of neighboring pixel q3 located atthe opposite side of pixel q2 with respect to the block boundary. Inaddition, in the right side of each of the expressions, coefficientswhich are multiplied with the respective pixel values of the pixels tobe used for deblocking filtering are filter coefficients.

Furthermore, in the deblocking filtering, clipping may be performed sothat the calculated pixel values are not changed more than a thresholdvalue. For example, in the clipping process the pixel values calculatedaccording to the above expressions may be clipped to a value obtainedaccording to “a computation pixel value±2×a threshold value” using athreshold value determined based on a quantization parameter. In thisway, it is possible to prevent excessive smoothing.

FIG. 26 is a conceptual diagram for illustrating a block boundary onwhich a deblocking filter process is performed. FIG. 27 is a conceptualdiagram for illustrating examples of Boundary strength (Bs) values.

The block boundary on which the deblocking filter process is performedis, for example, a boundary between CUs, Pus, or TUs having 8×8 pixelblocks as illustrated in FIG. 26 . The deblocking filter process may beperformed, for example, in units of four rows or four columns. First,boundary strength (Bs) values are determined as indicated in FIG. 27 forblock P and block Q illustrated in FIG. 26 .

According to the Bs values in FIG. 27 , whether to perform deblockingfilter processes of block boundaries belonging to the same image usingdifferent strengths may be determined. The deblocking filter process fora chroma signal is performed when a Bs value is 2. The deblocking filterprocess for a luma signal is performed when a Bs value is 1 or more anda determined condition is satisfied. The determined condition may bepredetermined. It is noted that conditions for determining Bs values arenot limited to those indicated in FIG. 27 , and a Bs value may bedetermined based on another parameter.

[Predictor (Intra Predictor, Inter Predictor, Prediction Controller)]

FIG. 28 is a flow chart illustrating one example of a process performedby a predictor of encoder 100. It is to be noted that the predictorincludes all or part of the following constituent elements: intrapredictor 124; inter predictor 126; and prediction controller 128. Theprediction executor includes, for example, intra predictor 124 and interpredictor 126.

The predictor generates a prediction image of a current block (StepSb_1). This prediction image may also be referred to as a predictionsignal or a prediction block. It is to be noted that the predictionsignal is, for example, an intra prediction image (image predictionsignal) or an inter prediction image (inter prediction signal). Thepredictor generates the prediction image of the current block using areconstructed image which has been already obtained through anotherblock through generation of a prediction image, generation of aprediction residual, generation of quantized coefficients, restoring ofa prediction residual, and addition of the prediction image.

The reconstructed image may be, for example, an image in a referencepicture, or an image of an encoded block (that is, the other blockdescribed above) in a current picture which is the picture including thecurrent block. The encoded block in the current picture is, for example,a neighboring block of the current block.

FIG. 29 is a flow chart illustrating another example of a processperformed by the predictor of the encoder 100.

The predictor generates a prediction image using a first method (StepSc_1 a), generates a prediction image using a second method (Step Sc_1b), and generates a prediction image using a third method (Step Sc_1 c).The first method, the second method, and the third method may bemutually different methods for generating a prediction image. Each ofthe first to third methods may be an inter prediction method, an intraprediction method, or another prediction method. The above-describedreconstructed image may be used in these prediction methods.

Next, the prediction processor evaluates the prediction images generatedin Steps Sc_1 a, Sc_1 b, and Sc_1 c (Step Sc_2). For example, thepredictor calculates costs C for the prediction images generated in StepSc_1 a, Sc_1 b, and Sc_1, and evaluates the prediction images bycomparing the costs C of the prediction images. It is to be noted thatcost C may be calculated, for example, according to an expression of anR-D optimization model, for example, C=D+λ×R. In this expression, Dindicates compression artifacts of a prediction image, and isrepresented as, for example, a sum of absolute differences between thepixel value of a current block and the pixel value of a predictionimage. In addition, R indicates a bit rate of a stream. In addition, λindicates, for example, a multiplier according to the method of Lagrangemultipliers.

The predictor then selects one of the prediction images generated inSteps Sc_1 a, Sc_1 b, and Sc_1 c (Step Sc_3). In other words, thepredictor selects a method or a mode for obtaining a final predictionimage. For example, the predictor selects the prediction image havingthe smallest cost C, based on costs C calculated for the predictionimages. Alternatively, the evaluation in Step Sc_2 and the selection ofthe prediction image in Step Sc_3 may be made based on a parameter whichis used in an encoding process. Encoder 100 may transform informationfor identifying the selected prediction image, the method, or the modeinto a stream. The information may be, for example, a flag or the like.In this way, decoder 200 is capable of generating a prediction imageaccording to the method or the mode selected by encoder 100, based onthe information. It is to be noted that, in the example illustrated inFIG. 29 , the predictor selects any of the prediction images after theprediction images are generated using the respective methods. However,the predictor may select a method or a mode based on a parameter for usein the above-described encoding process before generating predictionimages, and may generate a prediction image according to the method ormode selected.

For example, the first method and the second method may be intraprediction and inter prediction, respectively, and the predictor mayselect a final prediction image for a current block from predictionimages generated according to the prediction methods.

FIG. 30 is a flow chart illustrating another example of a processperformed by the predictor of encoder 100.

First, the predictor generates a prediction image using intra prediction(Step Sd_1 a), and generates a prediction image using inter prediction(Step Sd_1 b). It is to be noted that the prediction image generated byintra prediction is also referred to as an intra prediction image, andthe prediction image generated by inter prediction is also referred toas an inter prediction image.

Next, the predictor evaluates each of the intra prediction image and theinter prediction image (Step Sd_2). Cost C described above may be usedin the evaluation. The predictor may then select the prediction imagefor which the smallest cost C has been calculated among the intraprediction image and the inter prediction image, as the final predictionimage for the current block (Step Sd_3). In other words, the predictionmethod or the mode for generating the prediction image for the currentblock is selected.

The prediction processor then selects the prediction image for which thesmallest cost C has been calculated among the intra prediction image andthe inter prediction image, as the final prediction image for thecurrent block (Step Sd_3). In other words, the prediction method or themode for generating the prediction image for the current block isselected.

[Intra Predictor]

Intra predictor 124 generates a prediction signal (that is, intraprediction image) by performing intra prediction (also referred to asintra frame prediction) of the current block by referring to a block orblocks in the current picture and stored in block memory 118. Morespecifically, intra predictor 124 generates an intra prediction image byperforming intra prediction by referring to pixel values (for example,luma and/or chroma values) of a block or blocks neighboring the currentblock, and then outputs the intra prediction image to predictioncontroller 128.

For example, intra predictor 124 performs intra prediction by using onemode from among a plurality of intra prediction modes which have beendefined. The intra prediction modes typically include one or morenon-directional prediction modes and a plurality of directionalprediction modes. The defined modes may be predefined.

The one or more non-directional prediction modes include, for example,the planar prediction mode and DC prediction mode defined in theH.265/high-efficiency video coding (HEVC) standard.

The plurality of directional prediction modes include, for example, thethirty-three directional prediction modes defined in the H.265/HEVCstandard. It is to be noted that the plurality of directional predictionmodes may further include thirty-two directional prediction modes inaddition to the thirty-three directional prediction modes (for a totalof sixty-five directional prediction modes). FIG. 31 is a conceptualdiagram for illustrating sixty-seven intra prediction modes in totalthat may be used in intra prediction (two non-directional predictionmodes and sixty-five directional prediction modes). The solid arrowsrepresent the thirty-three directions defined in the H.265/HEVCstandard, and the dashed arrows represent the additional thirty-twodirections (the two non-directional prediction modes are not illustratedin FIG. 31 ).

In various kinds of processing examples, a luma block may be referred toin intra prediction of a chroma block. In other words, a chromacomponent of the current block may be predicted based on a lumacomponent of the current block. Such intra prediction is also referredto as cross-component linear model (CCLM) prediction. The intraprediction mode for a chroma block in which such a luma block isreferred to (also referred to as, for example, a CCLM mode) may be addedas one of the intra prediction modes for chroma blocks.

Intra predictor 124 may correct intra-predicted pixel values based onhorizontal/vertical reference pixel gradients. Intra predictionaccompanied by this sort of correcting is also referred to as positiondependent intra prediction combination (PDPC). Information indicatingwhether to apply PDPC (referred to as, for example, a PDPC flag) isnormally signaled at the CU level. It is to be noted that the signalingof such information does not necessarily need to be performed at the CUlevel, and may be performed at another level (for example, at thesequence level, picture level, slice level, tile level, or CTU level).

FIG. 32 is a flow chart illustrating one example of a process performedby intra predictor 124.

Intra predictor 124 selects one intra prediction mode from a pluralityof intra prediction modes (Step Sw_1). Intra predictor 124 thengenerates a prediction image according to the selected intra predictionmode (Step Sw_2). Next, intra predictor 124 determines most probablemodes (MPMs) (Step Sw_3). MPMs include, for example, six intraprediction modes. For example, two modes among the six intra predictionmodes may be planar mode and DC prediction mode, and the other fourmodes may be directional prediction modes. Intra predictor 124determines whether the intra prediction mode selected in Step Sw_1 isincluded in the MPMs (Step Sw_4).

Here, when determining that the intra prediction mode selected in StepSw_1 is included in the MPMs (Yes in Step Sw_4), intra predictor 124sets an MPM flag to 1 (Step Sw_5), and generates information indicatingthe selected intra prediction mode among the MPMs (Step Sw_6). It is tobe noted that the MPM flag set to 1 and the information indicating theintra prediction mode may be encoded as prediction parameters by entropyencoder 110.

When determining that the selected intra prediction mode is not includedin the MPMs (No in Step Sw_4), intra predictor 124 sets the MPM flag to0 (Step Sw_7). Alternatively, intra predictor 124 does not set any MPMflag. Intra predictor 124 then generates information indicating theselected intra prediction mode among at least one intra prediction modewhich is not included in the MPMs (Step Sw_8). It is to be noted thatthe MPM flag set to 0 and the information indicating the intraprediction mode may be encoded as prediction parameters by entropyencoder 110. The information indicating the intra prediction modeindicates, for example, any one of 0 to 60.

[Intra Predictor]

Inter predictor 126 generates a prediction image (inter predictionimage) by performing inter prediction (also referred to as inter frameprediction) of the current block by referring to a block or blocks in areference picture, which is different from the current picture and isstored in frame memory 122. Inter prediction is performed in units of acurrent block or a current sub-block (for example, a 4×4 block) in thecurrent block. The sub-block is included in the block and is a unitsmaller than the block. The size of the sub-block may be in the form ofa slice, brick, picture, etc.

For example, inter predictor 126 performs motion estimation in areference picture for a current block or a current sub-block, and findsa reference block or a reference sub-block which best matches thecurrent block or the current sub-block. Inter predictor 126 then obtainsmotion information (for example, a motion vector) which compensates amotion or a change from the reference block or the reference sub-blockto the current block or the sub-block. Inter predictor 126 generates aninter prediction image of the current block or the sub-block byperforming motion compensation (or motion prediction) based on themotion information. Inter predictor 126 outputs the generated interprediction image to prediction controller 128.

The motion information used in motion compensation may be signaled asinter prediction signals in various forms. For example, a motion vectormay be signaled. As another example, the difference between a motionvector and a motion vector predictor may be signaled.

[Reference Picture List]

FIG. 33 is a conceptual diagram for illustrating examples of referencepictures. FIG. 34 is a conceptual diagram for illustrating examples ofreference picture lists. A reference picture list is a list indicatingat least one reference picture stored in frame memory 122. It is to benoted that, in FIG. 33 , each of rectangles indicates a picture, each ofarrows indicates a picture reference relationship, the horizontal axisindicates time, I, P, and B in the rectangles indicate an intraprediction picture, a uni-prediction picture, and a bi-predictionpicture, respectively, and numerals in the rectangles indicate adecoding order. As illustrated in FIG. 33 , the decoding order of thepictures is an order of I0, P1, B2, B3, and B4, and the display order ofthe pictures is an order of I0, B3, B2, B4, and P1. As illustrated inFIG. 34 , the reference picture list is a list representing referencepicture candidates. For example, one picture (or a slice) may include atleast one reference picture list. For example, one reference picturelist is used when a current picture is a uni-prediction picture, and tworeference picture lists are used when a current picture is abi-prediction picture. In the examples of FIGS. 33 and 34 , picture B3which is current picture Cur Pic has two reference picture lists whichare the L0 list and the L1 list. When current picture Cur Pic is pictureB3, reference picture candidates for current picture Cur Pic are I0, P1,and B2, and the reference picture lists (which are the L0 list and theL1 list) indicate these pictures. Inter predictor 126 or predictioncontroller 128 specifies which picture in each reference picture list isto be actually referred to in form of a reference picture indexrefidxLx. In FIG. 34 , reference pictures P1 and B2 are specified byreference picture indices refldxL0 and refIdxL1.

Such a reference picture list may be generated for each unit such as asequence, picture, slice, brick, CTU, or CU. In addition, amongreference pictures indicated in reference picture lists, a referencepicture index indicating a reference picture to be referred to in interprediction may be signaled at the sequence level, picture level, slicelevel, brick level, CTU level, or CU level. In addition, a commonreference picture list may be used in a plurality of inter predictionmodes.

[Basic Flow of Inter Prediction]

FIG. 35 is a flow chart illustrating an example basic processing flow ofa process of inter prediction.

First, inter predictor 126 generates a prediction signal (Steps Se_1 toSe_3). Next, subtractor 104 generates the difference between a currentblock and a prediction image as a prediction residual (Step Se_4).

Here, in the generation of the prediction image, inter predictor 126generates the prediction image through determination of a motion vector(MV) of the current block (Steps Se_1 and Se_2) and motion compensation(Step Se_3). Furthermore, in determination of a MV, inter predictor 126determines the MV through selection of a motion vector candidate (MVcandidate) (Step Se_1) and derivation of a MV (Step Se_2). The selectionof the MV candidate is made by, for example, inter predictor 126generating a MV candidate list and selecting at least one MV candidatefrom the MV candidate list. It is to be noted that MVs derived in thepast may be added to the MV candidate list. Alternatively, in derivationof a MV, inter predictor 126 may further select at least one MVcandidate from the at least one MV candidate, and determine the selectedat least one MV candidate as the MV for the current block.Alternatively, inter predictor 126 may determine the MV for the currentblock by performing estimation in a reference picture region specifiedby each of the selected at least one MV candidate. It is to be notedthat the estimation in a reference picture region may be referred to asmotion estimation. In addition, although Steps Se_1 to Se_3 areperformed by inter predictor 126 in the above-described example, aprocess that is for example Step Se_1, Step Se_2, or the like may beperformed by another constituent element included in encoder 100.

It is to be noted that a MV candidate list may be generated for eachprocess in inter prediction mode, or a common MV candidate list may beused in a plurality of inter prediction modes. The processes in StepsSe_3 and Se_4 correspond to Steps Sa_3 and Sa_4 illustrated in FIG. 9 ,respectively. The process in Step Se_3 corresponds to the process inStep Sd_1 b in FIG. 30 .

[Motion Vector Derivation Flow]

FIG. 36 is a flow chart illustrating one example of a process ofderivation of motion vectors.

Inter predictor 126 may derive a MV of a current block in a mode forencoding motion information (for example, a MV). In this case, forexample, the motion information may be encoded as a predictionparameter, and may be signaled. In other words, the encoded motioninformation is included in a stream.

Alternatively, inter predictor 126 may derive a MV in a mode in whichmotion information is not encoded. In this case, no motion informationis included in the stream.

Here, MV derivation modes may include a normal inter mode, a normalmerge mode, a FRUC mode, an affine mode, etc. which are described later.Modes in which motion information is encoded among the modes include thenormal inter mode, the normal merge mode, the affine mode (specifically,an affine inter mode and an affine merge mode), etc. It is to be notedthat motion information may include not only a MV but also motion vectorpredictor selection information which is described later. Modes in whichno motion information is encoded include the FRUC mode, etc. Interpredictor 126 selects a mode for deriving a MV of the current block fromthe plurality of modes, and derives the MV of the current block usingthe selected mode.

FIG. 37 is a flow chart illustrating another example of derivation ofmotion vectors.

Inter predictor 126 may derives a MV for a current block in a mode inwhich a MV difference is encoded. In this case, for example, the MVdifference may be encoded as a prediction parameter, and may besignaled. In other words, the encoded MV difference is included in astream. The MV difference is the difference between the MV of thecurrent block and the MV predictor. It is to be noted that the MVpredictor is a motion vector predictor.

Alternatively, inter predictor 126 may derive a MV in a mode in which noMV difference is encoded. In this case, no encoded MV difference isincluded in the stream.

Here, as described above, the MV derivation modes include the normalinter mode, the normal merge mode, the FRUC mode, the affine mode, etc.which are described later. Modes in which a MV difference is encodedamong the modes include the normal inter mode, the affine mode(specifically, the affine inter mode), etc. Modes in which no MVdifference is encoded include the FRUC mode, the normal merge mode, theaffine mode (specifically, the affine merge mode), etc. Inter predictor126 selects a mode for deriving a MV of the current block from theplurality of modes, and derives the MV of the current block using theselected mode.

[Motion Vector Derivation Modes]

FIGS. 38A and 38B are conceptual diagrams for illustrating examplecategorization of modes for MV derivation. For example, as illustratedin FIG. 38A, MV derivation modes are roughly categorized into threemodes according to whether to encode motion information and whether toencode MV differences. The three modes are inter mode, merge mode, andframe rate up-conversion (FRUC) mode. The inter mode is a mode in whichmotion estimation is performed, and in which motion information and a MVdifference are encoded. For example, as illustrated in FIG. 38B, theinter mode includes affine inter mode and normal inter mode. The mergemode is a mode in which no motion estimation is performed, and in whicha MV is selected from an encoded surrounding block and a MV for thecurrent block is derived using the MV. The merge mode is a mode inwhich, basically, motion information is encoded and no MV difference isencoded. For example, as illustrated in FIG. 38B, the merge modesinclude normal merge mode (also referred to as normal merge mode orregular merge mode), merge with motion vector difference (MMVD) mode,combined inter merge/intra prediction (CIIP) mode, triangle mode, ATMVPmode, and affine merge mode. Here, a MV difference is encodedexceptionally in the MMVD mode among the modes included in the mergemodes. It is to be noted that the affine merge mode and the affine intermode are modes included in the affine modes. The affine mode is a modefor deriving, as a MV of a current block, a MV of each of a plurality ofsub-blocks included in the current block, assuming affine transform. TheFRUC mode is a mode which is for deriving a MV of the current block byperforming estimation between encoded regions, and in which neithermotion information nor any MV difference is encoded. It is to be notedthat the respective modes will be described later in more detail.

It is to be noted that the categorization of the modes illustrated inFIGS. 38A and 38B are examples, and categorization is not limitedthereto. For example, when a MV difference is encoded in CIIP mode, theCIIP mode is categorized into inter modes.

[MV Derivation>Normal Inter Mode]

The normal inter mode is an inter prediction mode for deriving a MV of acurrent block based on a block similar to the image of the current blockfrom a reference picture region specified by a MV candidate. In thisnormal inter mode, a MV difference is encoded.

FIG. 39 is a flow chart illustrating an example of a process of interprediction in normal inter mode.

First, inter predictor 126 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of encodedblocks temporally or spatially surrounding the current block (StepSg_1). In other words, inter predictor 126 generates a MV candidatelist.

Next, inter predictor 126 extracts N (an integer of 2 or larger) MVcandidates from the plurality of MV candidates obtained in Step Sg_1, asmotion vector predictor candidates (also referred to as MV predictorcandidates) according to a determined priority order (Step Sg_2). It isto be noted that the priority order may be determined in advance foreach of the N MV candidates.

Next, inter predictor 126 selects one motion vector predictor candidatefrom the N motion vector predictor candidates, as the motion vectorpredictor (also referred to as a MV predictor) of the current block(Step Sg_3). At this time, inter predictor 126 encodes, in a stream,motion vector predictor selection information for identifying theselected motion vector predictor. In other words, inter predictor 126outputs the MV predictor selection information as a prediction parameterto entropy encoder 110 through prediction parameter generator 130.

Next, inter predictor 126 derives a MV of a current block by referringto an encoded reference picture (Step Sg_4). At this time, interpredictor 126 further encodes, in the stream, the difference valuebetween the derived MV and the motion vector predictor as a MVdifference. In other words, inter predictor 126 outputs the MVdifference as a prediction parameter to entropy encoder 110 throughprediction parameter generator 130. It is to be noted that the encodedreference picture is a picture including a plurality of blocks whichhave been reconstructed after being encoded.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the encoded reference picture (Step Sg_5). The processesin Steps Sg_1 to Sg_5 are executed on each block. For example, when theprocesses in Steps Sg_1 to Sg_5 are executed on all the blocks in theslice, inter prediction of the slice using the normal inter modefinishes. For example, when the processes in Steps Sg_1 to Sg_5 areexecuted on all the blocks in the picture, inter prediction of thepicture using the normal inter mode finishes. It is to be noted that notall the blocks included in the slice the processes may be subjected toin Steps Sg_1 to Sg_5, and inter prediction of the slice using thenormal inter mode may finish when part of the blocks are subjected tothe processes. This also applies to processes in Steps Sg_1 to Sg_5.Inter prediction of the picture using the normal inter mode may finishwhen the processes are executed on part of the blocks in the picture.

It is to be noted that the prediction image is an inter predictionsignal as described above. In addition, information indicating the interprediction mode (normal inter mode in the above example) used togenerate the prediction image is, for example, encoded as a predictionparameter in an encoded signal.

It is to be noted that the MV candidate list may be also used as a listfor use in another mode. In addition, the processes related to the MVcandidate list may be applied to processes related to the list for usein another mode. The processes related to the MV candidate list include,for example, extraction or selection of a MV candidate from the MVcandidate list, reordering of MV candidates, or deletion of a MVcandidate.

[MV Derivation>Normal Merge Mode]

The normal merge mode is an inter prediction mode for selecting a MVcandidate from a MV candidate list as a MV of a current block, therebyderiving the MV. It is to be noted that the normal merge mode is a typeof merge mode and may simply be referred to as a merge mode. In thisembodiment, the normal merge mode and the merge mode are distinguished,and the merge mode is used in a broader meaning.

FIG. 40 is a flow chart illustrating an example of inter prediction innormal merge mode.

First, inter predictor 126 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of encodedblocks temporally or spatially surrounding the current block (StepSh_1). In other words, inter predictor 126 generates a MV candidatelist.

Next, inter predictor 126 selects one MV candidate from the plurality ofMV candidates obtained in Step Sh_1, thereby deriving a MV of thecurrent block (Step Sh_2). At this time, inter predictor 126 encodes, ina stream, MV selection information for identifying the selected MVcandidate. In other words, inter predictor 126 outputs the MV selectioninformation as a prediction parameter to entropy encoder 110 throughprediction parameter generator 130.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the encoded reference picture (Step Sh_3). The processesin Steps Sh_1 to Sh_3 are executed, for example, on each block. Forexample, when the processes in Steps Sh_1 to Sh_3 are executed on allthe blocks in the slice, inter prediction of the slice using the normalmerge mode finishes. In addition, when the processes in Steps Sh_1 toSh_3 are executed on all the blocks in the picture, inter prediction ofthe picture using the normal merge mode finishes. It is to be noted thatnot all the blocks included in the slice may be subjected to theprocesses in Steps Sh_1 to Sh_3, and inter prediction of the slice usingthe normal merge mode may finish when part of the blocks are subjectedto the processes. This also applies to processes in Steps Sh_1 to Sh_3.Inter prediction of the picture using the normal merge mode may finishwhen the processes are executed on part of the blocks in the picture.

In addition, information indicating the inter prediction mode (normalmerge mode in the above example) used to generate the prediction imageand included in the encoded signal is, for example, encoded as aprediction parameter in a stream.

FIG. 41 is a conceptual diagram for illustrating one example of a motionvector derivation process of a current picture by a normal merge mode.

First, inter predictor 126 generates a MV candidate list in which MVcandidates are registered. Examples of MV candidates include: spatiallyneighboring MV candidates which are MVs of a plurality of encoded blockslocated spatially surrounding a current block; temporally neighboring MVcandidates which are MVs of surrounding blocks on which the position ofa current block in an encoded reference picture is projected; combinedMV candidates which are MVs generated by combining the MV value of aspatially neighboring MV predictor and the MV value of a temporallyneighboring MV predictor; and a zero MV candidate which is a MV having azero value.

Next, inter predictor 126 selects one MV candidate from a plurality ofMV candidates registered in a MV candidate list, and determines the MVcandidate as the MV of the current block.

Furthermore, entropy encoder 110 writes and encodes, in a stream,merge_idx which is a signal indicating which MV candidate has beenselected.

It is to be noted that the MV candidates registered in the MV candidatelist described in FIG. 41 are examples. The number of MV candidates maybe different from the number of MV candidates in the diagram, the MVcandidate list may be configured in such a manner that some of the kindsof the MV candidates in the diagram may not be included, or that one ormore MV candidates other than the kinds of MV candidates in the diagramare included.

A final MV may be determined by performing a dynamic motion vectorrefreshing (DMVR) to be described later using the MV of the currentblock derived by normal merge mode. It is to be noted that, in normalmerge mode, motion information is encoded and no MV difference isencoded. In MMVD mode, one MV candidate is selected from a MV candidatelist as in the case of normal merge mode, a MV difference is encoded. Asillustrated in FIG. 38B, MMVD may be categorized into merge modestogether with normal merge mode. It is to be noted that the MVdifference in MMVD mode does not always need to be the same as the MVdifference for use in inter mode. For example, MV difference derivationin MMVD mode may be a process that requires a smaller amount ofprocessing than the amount of processing required for MV differencederivation in inter mode.

In addition, a combined inter merge/intra prediction (CIIP) mode may beperformed. The mode is for overlapping a prediction image generated ininter prediction and a prediction image generated in intra prediction togenerate a prediction image for a current block.

It is to be noted that the MV candidate list may be referred to as acandidate list. In addition, merge_idx is MV selection information.

[MV Derivation>HMVP Mode]

FIG. 42 is a conceptual diagram for illustrating one example of a MVderivation process for a current picture using HMVP merge mode.

In normal merge mode, a MV for, for example, a CU which is a currentblock is determined by selecting one MV candidate from a MV listgenerated by referring to an encoded block (for example, a CU). Here,another MV candidate may be registered in the MV candidate list. Themode in which such another MV candidate is registered is referred to asHMVP mode.

In HMVP mode, MV candidates are managed using a first-in first-out(FIFO) server for HMVP, separately from the MV candidate list for normalmerge mode.

In a FIFO buffer, motion information such as MVs of blocks processed inthe past are stored newest first. In the management of the FIFO buffer,each time when one block is processed, the MV for the newest block (thatis the CU processed immediately before) is stored in the FIFO buffer,and the MV of the oldest CU (that is, the CU processed earliest) isdeleted from the FIFO buffer. In the example illustrated in FIG. 42 ,HMVP1 is the MV for the newest block, and HMVP5 is the MV for the oldestMV.

Inter predictor 126 then, for example, checks whether each MV managed inthe FIFO buffer is a MV different from all the MV candidates which havebeen already registered in the MV candidate list for normal merge modestarting from HMVP1. When determining that the MV is different from allthe MV candidates, inter predictor 126 may add the MV managed in theFIFO buffer in the MV candidate list for normal merge mode as a MVcandidate. At this time, one or more of the MV candidates in the FIFObuffer may be registered (added to the MV candidate list).

By using the HMVP mode in this way, it is possible to add not only theMV of a block which neighbors the current block spatially or temporallybut also a MV for a block processed in the past. As a result, thevariation of MV candidates for normal merge mode is expanded, whichincreases the probability that coding efficiency can be increased.

It is to be noted that the MV may be motion information. In other words,information stored in the MV candidate list and the FIFO buffer mayinclude not only MV values but also reference picture information,reference directions, the numbers of pictures, etc. In addition, theblock may be, for example, a CU.

It is to be noted that the MV candidate list and the FIFO bufferillustrated in FIG. 42 are examples. The MV candidate list and FIFObuffer may be different in size from those in FIG. 42 , or may beconfigured to register MV candidates in an order different from the onein FIG. 42 . In addition, the process described here may be commonbetween encoder 100 and decoder 200.

It is to be noted that the HMVP mode can be applied for modes other thanthe normal merge mode. For example, it is also possible that motioninformation such as MVs of blocks processed in affine mode in the pastmay be stored newest first, and may be used as MV candidates, which mayfacilitate better efficiency. The mode obtained by applying HMVP mode toaffine mode may be referred to as history affine mode.

[MV Derivation>FRUC Mode]

Motion information may be derived at the decoder side without beingsignaled from the encoder side. For example, motion information may bederived by performing motion estimation at the decoder 200 side. In anembodiment, at the decoder side, motion estimation is performed withoutusing any pixel value in a current block. Modes for performing motionestimation at the decoder 200 side without using any pixel value in acurrent block include a frame rate up-conversion (FRUC) mode, a patternmatched motion vector derivation (PMMVD) mode, etc.

One example of a FRUC process in the form of a flow chart is illustratedin FIG. 43 . First, a list which indicates, as MV candidates, MVs forencoded blocks each of which neighbors the current block spatially ortemporally by referring to the MVs (the list may be a MV candidate list,and be also used as the MV candidate list for normal merge mode) (StepSi_1).

Next, a best MV candidate is selected from the plurality of MVcandidates registered in the MV candidate list (Step Si_2). For example,the evaluation values of the respective MV candidates included in the MVcandidate list are calculated, and one MV candidate is selected based onthe evaluation values. Based on the selected motion vector candidates, amotion vector for the current block is then derived (Step Si_4). Morespecifically, for example, the selected motion vector candidate (best MVcandidate) is derived directly as the motion vector for the currentblock. In addition, for example, the motion vector for the current blockmay be derived using pattern matching in a surrounding region of aposition in a reference picture where the position in the referencepicture corresponds to the selected motion vector candidate. In otherwords, estimation using the pattern matching and the evaluation valuesmay be performed in the surrounding region of the best MV candidate, andwhen there is a MV that yields a better evaluation value, the best MVcandidate may be updated to the MV that yields the better evaluationvalue, and the updated MV may be determined as the final MV for thecurrent block. In some embodiments, updating of the motion vector whichyields a better evaluation value may not be performed.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the encoded reference picture (Step Si_5). The processesin Steps Si_1 to Si_5 are executed, for example, on each block. Forexample, when the processes in Steps Si_1 to Si_5 are executed on allthe blocks in the slice, inter prediction of the slice using the FRUCmode finishes. For example, when the processes in Steps Si_1 to Si_5 areexecuted on all the blocks in the picture, inter prediction of thepicture using the FRUC mode finishes. It is to be noted that not all theblocks included in the slice may be subjected to the processes in StepsSi_1 to Si_5, and inter prediction of the slice using the FRUC mode mayfinish when part of the blocks are subjected to the processes. When theprocesses in Steps Si_1 to Si_5 are executed on part of blocks includedin a picture in a similar manner, inter prediction of the picture usingthe FRUC mode may finish.

A similar process may be performed in units of a sub-block.

Evaluation values may be calculated according to various kinds ofmethods. For example, a comparison is made between a reconstructed imagein a region in a reference picture corresponding to a motion vector, anda reconstructed image in a determined region (the region may be, forexample, a region in another reference picture or a region in aneighboring block of a current picture, as indicated below). Thedetermined region may be predetermined.

The difference between the pixel values of the two reconstructed imagesmay be used for an evaluation value of the motion vectors. It is to benoted that an evaluation value may be calculated using information otherthan the value of the difference.

Next, an example of pattern matching is described in detail. First, oneMV candidate included in a MV candidate list (for example, a merge list)is selected as a start point of estimation by the pattern matching. Forexample, as the pattern matching, either a first pattern matching or asecond pattern matching may be used. The first pattern matching and thesecond pattern matching may be referred to as bilateral matching andtemplate matching, respectively.

[MV Derivation>FRUC>Bilateral Matching]

In the first pattern matching, pattern matching is performed between twoblocks which are located along a motion trajectory of a current blockand are included in two different reference pictures. Accordingly, inthe first pattern matching, a region in another reference picture alongthe motion trajectory of the current block is used as a determinedregion for calculating the evaluation value of the above-describedcandidate. The determined region may be predetermined.

FIG. 44 is a conceptual diagram for illustrating one example of thefirst pattern matching (bilateral matching) between the two blocks inthe two reference pictures along the motion trajectory. As illustratedin FIG. 44 , in the first pattern matching, two motion vectors (MV0,MV1) are derived by estimating a pair which best matches among pairs inthe two blocks included in the two different reference pictures (Ref0,Ref1) and located along the motion trajectory of the current block (Curblock). More specifically, a difference between the reconstructed imageat a specified location in the first encoded reference picture (Ref0)specified by a MV candidate, and the reconstructed image at a specifiedlocation in the second encoded reference picture (Ref1) specified by asymmetrical MV obtained by scaling the MV candidate at a display timeinterval is derived for the current block, and an evaluation value iscalculated using the value of the obtained difference. It is possible toselect, as the final MV, the MV candidate which yields the bestevaluation value among the plurality of MV candidates, and which islikely to produce good results.

In the assumption of a continuous motion trajectory, the motion vectors(MV0, MV1) specifying the two reference blocks are proportional totemporal distances (TD0, TD1) between the current picture (Cur Pic) andthe two reference pictures (Ref0, Ref1). For example, when the currentpicture is temporally located between the two reference pictures and thetemporal distances from the current picture to the respective tworeference pictures are equal to each other, mirror-symmetricalbi-directional motion vectors are derived in the first pattern matching.

[MV Derivation>FRUC>Template Matching]

In the second pattern matching (template matching), pattern matching isperformed between a block in a reference picture and a template in thecurrent picture (the template is a block neighboring the current blockin the current picture (the neighboring block is, for example, an upperand/or left neighboring block(s))). Accordingly, in the second patternmatching, the block neighboring the current block in the current pictureis used as the determined region for calculating the evaluation value ofthe above-described MV candidate.

FIG. 45 is a conceptual diagram for illustrating one example of patternmatching (template matching) between a template in a current picture anda block in a reference picture. As illustrated in FIG. 45 , in thesecond pattern matching, the motion vector of the current block (Curblock) is derived by estimating, in the reference picture (Ref0), theblock which best matches the block neighboring the current block in thecurrent picture (Cur Pic). More specifically, the difference between areconstructed image in an encoded region which neighbors both left andabove or either left or above and a reconstructed image which is in acorresponding region in the encoded reference picture (Ref0) and isspecified by a MV candidate is derived, and an evaluation value iscalculated using the value of the obtained difference. The MV candidatewhich yields the best evaluation value among a plurality of MVcandidates may be selected as the best MV candidate.

Such information indicating whether to apply the FRUC mode (referred toas, for example, a FRUC flag) may be signaled at the CU level. Inaddition, when the FRUC mode is applied (for example, when a FRUC flagis true), information indicating an applicable pattern matching method(e.g., the first pattern matching or the second pattern matching) may besignaled at the CU level. It is to be noted that the signaling of suchinformation does not necessarily need to be performed at the CU level,and may be performed at another level (for example, at the sequencelevel, picture level, slice level, tile level, CTU level, or sub-blocklevel).

[MV Derivation>Affine Mode]

The affine mode is a mode for generating a MV using affine transform.For example, a MV may be derived in units of a sub-block based on motionvectors of a plurality of neighboring blocks. This mode is also referredto as an affine motion compensation prediction mode.

FIG. 46A is a conceptual diagram for illustrating one example of MVderivation in units of a sub-block based on motion vectors of aplurality of neighboring blocks. In FIG. 46A, the current blockincludes, for example, sixteen 4×4 sub-blocks. Here, motion vector V₀ atan upper-left corner control point in the current block is derived basedon a motion vector of a neighboring block, and likewise, motion vectorV₁ at an upper-right corner control point in the current block isderived based on a motion vector of a neighboring sub-block. Two motionvectors v₀ and v₁ may be projected according to an expression (1A)indicated below, and motion vectors (v_(x), v_(y)) for the respectivesub-blocks in the current block may be derived.

$\begin{matrix}\left\lbrack {{{Math}.1}A} \right\rbrack &  \\\left\{ \begin{matrix}{v_{x} = {{\frac{\left( {v_{1x} - v_{0x}} \right)}{w}x} - {\frac{\left( {v_{1y} - v_{0y}} \right)}{w}y} + v_{0x}}} \\{v_{y} = {{\frac{\left( {v_{1y} - v_{0y}} \right)}{w}x} - {\frac{\left( {v_{1x} - v_{0x}} \right)}{w}y} + v_{0y}}}\end{matrix} \right. & \left( {1A} \right)\end{matrix}$

Here, x and y indicate the horizontal position and the vertical positionof the sub-block, respectively, and w indicates a determined weightingcoefficient. The determined weighting coefficient may be predetermined.

Such information indicating the affine mode (for example, referred to asan affine flag) may be signaled at the CU level. It is to be noted thatthe signaling of the information indicating the affine mode does notnecessarily need to be performed at the CU level, and may be performedat another level (for example, at the sequence level, picture level,slice level, tile level, CTU level, or sub-block level).

In addition, the affine mode may include several modes for differentmethods for deriving motion vectors at the upper-left and upper-rightcorner control points. For example, the affine mode include two modeswhich are the affine inter mode (also referred to as an affine normalinter mode) and the affine merge mode.

[MV Derivation>Affine Mode]

FIG. 46B is a conceptual diagram for illustrating one example of MVderivation in units of a sub-block in affine mode in which three controlpoints are used. In FIG. 46B, the current block includes, for example,sixteen 4×4 blocks. Here, motion vector V₀ at the upper-left cornercontrol point in the current block is derived based on a motion vectorof a neighboring block. Here, motion vector V₁ at the upper-right cornercontrol point in the current block is derived based on a motion vectorof a neighboring block, and likewise motion vector V₂ at the lower-leftcorner control point for the current block is derived based on a motionvector of a neighboring block. Three motion vectors v₀, v₁, and v₂ maybe projected according to an expression (1B) indicated below, and motionvectors (v_(x), v_(y)) for the respective sub-blocks in the currentblock may be derived.

$\begin{matrix}\left\lbrack {{{Math}.1}B} \right\rbrack &  \\\left\{ \begin{matrix}{v_{x} = {{\frac{\left( {v_{!x} - v_{0x}} \right)}{w}x} - {\frac{\left( {v_{2x} - v_{0x}} \right)}{h}y} + v_{0x}}} \\{v_{y} = {{\frac{\left( {v_{1y} - v_{0y}} \right)}{w}x} - {\frac{\left( {v_{2y} - v_{0y}} \right)}{h}y} + v_{0y}}}\end{matrix} \right. & \left( {1B} \right)\end{matrix}$

Here, x and y indicate the horizontal position and the vertical positionof the sub-block, respectively, and w and h may be weightingcoefficients, which may be predetermined weighting coefficients. In anembodiment, w may indicate the width of the current block, and h mayindicate the height of the current block.

Affine modes in which different numbers of control points (for example,two and three control points) are used may be switched and signaled atthe CU level. It is to be noted that information indicating the numberof control points in affine mode used at the CU level may be signaled atanother level (for example, the sequence level, picture level, slicelevel, tile level, CTU level, or sub-block level).

In addition, such an affine mode in which three control points are usedmay include different methods for deriving motion vectors at theupper-left, upper-right, and lower-left corner control points. Forexample, the affine modes in which three control points are used mayinclude two modes which are the affine inter mode and the affine mergemode, as in the case of affine modes in which two control points areused.

It is to be noted that, in the affine modes, the size of each sub-blockincluded in the current block may not be limited to 4×4 pixels, and maybe another size. For example, the size of each sub-block may be 8×8pixels.

[MV Derivation>Affine Mode>Control Point]

FIG. 47A, FIG. 47B, and FIG. 47C are conceptual diagrams forillustrating examples of MV derivation at control points in an affinemode.

As illustrated in FIG. 47A, in the affine mode, for example, motionvector predictors at respective control points of a current block arecalculated based on a plurality of motion vectors corresponding toblocks encoded according to the affine mode among encoded block A(left), block B (upper), block C (upper-right), block D (lower-left),and block E (upper-left) which neighbor the current block. Morespecifically, encoded block A (left), block B (upper), block C(upper-right), block D (lower-left), and block E (upper-left) arechecked in the listed order, and the first effective block encodedaccording to the affine mode is identified. Motion vector predictors atthe control points of the current block are calculated based on aplurality of motion vectors corresponding to the identified block.

For example, as illustrated in FIG. 47B, when block A which neighbors tothe left of the current block has been encoded according to an affinemode in which two control points are used, motion vectors v₃ and v₄projected at the upper-left corner position and the upper-right cornerposition of the encoded block including block A are derived. Motionvector v₀ at the upper-left corner control point of the current blockand motion vector v₁ at the upper-right corner control point of thecurrent block are then calculated from derived motion vectors v₃ and v₄.

For example, as illustrated in FIG. 47C, when block A which neighbors tothe left of the current block has been encoded according to an affinemode in which three control points are used, motion vectors v₃, v₄, andv₅ projected at the upper-left corner position, the upper-right cornerposition, and the lower-left corner position of the encoded blockincluding block A are derived. Motion vector v₀ at the upper-left cornercontrol point of the current block, motion vector v₁ at the upper-rightcorner control point of the current block, and motion vector v₂ at thelower-left corner control point of the current block are then calculatedfrom derived motion vectors v₃, v₄, and v₅.

The MV derivation methods illustrated in FIGS. 47A to 47C may be used inthe MV derivation at each control point for the current block in StepSk_1 illustrated in FIG. 50 , or may be used for MV predictor derivationat each control point for the current block in Step Sj_1 illustrated inFIG. 51 described later.

FIGS. 48A and 48B are conceptual diagrams for illustrating examples ofMV derivation at control points in affine mode.

FIG. 48A is a conceptual diagram for illustrating an example affine modein which two control points are used.

In the affine mode, as illustrated in FIG. 48A, a MV selected from MVsat encoded block A, block B, and block C which neighbor the currentblock is used as motion vector v₀ at the upper-left corner control pointfor the current block. Likewise, a MV selected from MVs of encoded blockD and block E which neighbor the current block is used as motion vectorv₁ at the upper-right corner control point for the current block.

FIG. 48B is a conceptual diagram for illustrating an example affine modein which three control points are used.

In the affine mode, as illustrated in FIG. 48B, a MV selected from MVsat encoded block A, block B, and block C which neighbor the currentblock is used as motion vector v₀ at the upper-left corner control pointfor the current block. Likewise, a MV selected from MVs of encoded blockD and block E which neighbor the current block is used as motion vectorv₁ at the upper-right corner control point for the current block.Furthermore, a MV selected from MVs of encoded block F and block G whichneighbor the current block is used as motion vector v₂ at the lower-leftcorner control point for the current block.

It is to be noted that the MV derivation methods illustrated in FIGS.48A and 48B may be used in the MV derivation at each control point forthe current block in Step Sk_1 illustrated in FIG. 50 described later,or may be used for MV predictor derivation at each control point for thecurrent block in Step Sj_1 illustrated in FIG. 51 described later.

Here, when affine modes in which different numbers of control points(for example, two and three control points) are used may be switched andsignaled at the CU level, the number of control points for an encodedblock and the number of control points for a current block may bedifferent from each other.

FIGS. 49A and 49B are conceptual diagrams for illustrating examples of amethod for MV derivation at control points when the number of controlpoints for an encoded block and the number of control points for acurrent block are different from each other.

For example, as illustrated in FIG. 49A, a current block has threecontrol points at the upper-left corner, the upper-right corner, and thelower-left corner, and block A which neighbors to the left of thecurrent block has been encoded according to an affine mode in which twocontrol points are used. In this case, motion vectors v₃ and v₄projected at the upper-left corner position and the upper-right cornerposition in the encoded block including block A are derived. Motionvector v₀ at the upper-left corner control point and motion vector v₁ atthe upper-right corner control point for the current block are thencalculated from derived motion vectors v₃ and v₄. Furthermore, motionvector v₂ at the lower-left corner control point is calculated fromderived motion vectors v₀ and v₁. For example, as illustrated in FIG.49B, a current block has two control points at the upper-left corner andthe upper-right corner, and block A which neighbors to the left of thecurrent block has been encoded according to an affine mode in whichthree control points are used. In this case, motion vectors v₃, v₄, andv₅ projected at the upper-left corner position in the encoded blockincluding block A, the upper-right corner position in the encoded block,and the lower-left corner position in the encoded block are derived.Motion vector v₀ at the upper-left corner control point for the currentblock and motion vector v₁ at the upper-right corner control point forthe current block are then calculated from derived motion vectors v₃,v₄, and v₅.

It is to be noted that the MV derivation methods illustrated in FIGS.49A and 49B may be used in the MV derivation at each control point forthe current block in Step Sk_1 illustrated in FIG. 50 described later,or may be used for MV predictor derivation at each control point for thecurrent block in Step Sj_1 illustrated in FIG. 51 described later.

[MV Derivation>Affine Mode>Affine Merge Mode]

FIG. 50 is a flow chart illustrating one example of a process in theaffine merge mode.

In affine merge mode as illustrated, first, inter predictor 126 derivesMVs at respective control points for a current block (Step Sk_1). Thecontrol points are an upper-left corner point of the current block andan upper-right corner point of the current block as illustrated in FIG.46A, or an upper-left corner point of the current block, an upper-rightcorner point of the current block, and a lower-left corner point of thecurrent block as illustrated in FIG. 46B. Inter predictor 126 may encodeMV selection information for identifying two or three derived MVs in astream.

For example, when MV derivation methods illustrated in FIGS. 47A to 47Care used, as illustrated in FIG. 47A, inter predictor 126 checks encodedblock A (left), block B (upper), block C (upper-right), block D(lower-left), and block E (upper-left) in the listed order, andidentifies the first effective block encoded according to the affinemode.

Inter predictor 126 derives the MV at the control point using theidentified first effective block encoded according to the identifiedaffine mode. For example, when block A is identified and block A has twocontrol points, as illustrated in FIG. 47B, inter predictor 126calculates motion vector v₀ at the upper-left corner control point ofthe current block and motion vector v₁ at the upper-right corner controlpoint of the current block from motion vectors v₃ and v₄ at theupper-left corner of the encoded block including block A and theupper-right corner of the encoded block. For example, inter predictor126 calculates motion vector v₀ at the upper-left corner control pointof the current block and motion vector v₁ at the upper-right cornercontrol point of the current block by projecting motion vectors v₃ andv₄ at the upper-left corner and the upper-right corner of the encodedblock onto the current block.

Alternatively, when block A is identified and block A has three controlpoints, as illustrated in FIG. 47C, inter predictor 126 calculatesmotion vector v₀ at the upper-left corner control point of the currentblock, motion vector v₁ at the upper-right corner control point of thecurrent block, and motion vector v₂ at the lower-left corner controlpoint of the current block from motion vectors v₃, v₄, and v₅ at theupper-left corner of the encoded block including block A, theupper-right corner of the encoded block, and the lower-left corner ofthe encoded block. For example, inter predictor 126 calculates motionvector v₀ at the upper-left corner control point of the current block,motion vector v₁ at the upper-right corner control point of the currentblock, and motion vector v₂ at the lower-left corner control point ofthe current block by projecting motion vectors v₃, v₄, and v₅ at theupper-left corner, the upper-right corner, and the lower-left corner ofthe encoded block onto the current block.

It is to be noted that, as illustrated in FIG. 49A described above, MVsat three control points may be calculated when block A is identified andblock A has two control points, and that, as illustrated in FIG. 49Bdescribed above, MVs at two control points may be calculated when blockA is identified and block A has three control points.

Next, inter predictor 126 performs motion compensation of each of aplurality of sub-blocks included in the current block. In other words,inter predictor 126 calculates a MV for each of a plurality ofsub-blocks as an affine MV, for example using two motion vectors v₀ andv₁ and the above expression (1A) or three motion vectors v₀, v₁, and v₂and the above expression (1B) (Step Sk_2). Inter predictor 126 thenperforms motion compensation of the sub-blocks using these affine MVsand encoded reference pictures (Step Sk_3). When the processes in StepsSk_2 and Sk_3 are executed for each of all the sub-blocks included inthe current block, the process for generating a prediction image usingthe affine merge mode for the current block finishes. In other words,motion compensation of the current block is performed to generate aprediction image of the current block.

It is to be noted that the above-described MV candidate list may begenerated in Step Sk_1. The MV candidate list may be, for example, alist including MV candidates derived using a plurality of MV derivationmethods for each control point. The plurality of MV derivation methodsmay be, for example, any combination of the MV derivation methodsillustrated in FIGS. 47A to 47C, the MV derivation methods illustratedin FIGS. 48A and 48B, the MV derivation methods illustrated in FIGS. 49Aand 49B, and other MV derivation methods.

It is to be noted that MV candidate lists may include MV candidates in amode in which prediction is performed in units of a sub-block, otherthan the affine mode. It is to be noted that, for example, a MVcandidate list including MV candidates in an affine merge mode in whichtwo control points are used and an affine merge mode in which threecontrol points are used may be generated as a MV candidate list.Alternatively, a MV candidate list including MV candidates in the affinemerge mode in which two control points are used and a MV candidate listincluding MV candidates in the affine merge mode in which three controlpoints are used may be generated separately. Alternatively, a MVcandidate list including MV candidates in one of the affine merge modein which two control points are used and the affine merge mode in whichthree control points are used may be generated. The MV candidate(s) maybe, for example, MVs for encoded block A (left), block B (upper), blockC (upper-right), block D (lower-left), and block E (upper-left), or a MVfor an effective block among the blocks.

It is to be noted that index indicating one of the MVs in a MV candidatelist may be transmitted as MV selection information.

[MV Derivation>Affine Mode>Affine Inter Mode]

FIG. 51 is a flow chart illustrating one example of a process in anaffine inter mode.

In the affine inter mode, first, inter predictor 126 derives MVpredictors (v₀, v₁) or (v₀, v₁, v₂) of respective two or three controlpoints for a current block (Step Sj_1). The control points may be, forexample, an upper-left corner point for the current block, anupper-right corner point of the current block, and an upper-right cornerpoint for the current block as illustrated in FIG. 46A or FIG. 46B.

For example, when the MV derivation methods illustrated in FIGS. 48A and48B are used, inter predictor 126 derives the MV predictors (v₀, v₁) or(v₀, v₁, v₂) at respective two or three control points for the currentblock by selecting MVs of any of the blocks among encoded blocks in thevicinity of the respective control points for the current blockillustrated in FIG. 48A or FIG. 48B. At this time, inter predictor 126encodes, in a stream, MV predictor selection information for identifyingthe selected two or three MV predictors.

For example, inter predictor 126 may determine, using a cost evaluationor the like, the block from which a MV as a MV predictor at a controlpoint is selected from among encoded blocks neighboring the currentblock, and may write, in a bitstream, a flag indicating which MVpredictor has been selected. In other words, inter predictor 126outputs, as a prediction parameter, the MV predictor selectioninformation such as a flag to entropy encoder 110 through predictionparameter generator 130.

Next, inter predictor 126 performs motion estimation (Step Sj_3 andSj_4) while updating the MV predictor selected or derived in Step Sj_1(Step Sj_2). In other words, inter predictor 126 calculates, as anaffine MV, a MV of each of sub-blocks which corresponds to an updated MVpredictor, using the expression (1A) or expression (1B) described above(Step Sj_3). Inter predictor 126 then performs motion compensation ofthe sub-blocks using these affine MVs and encoded reference pictures(Step Sj_4). The processes in Step Sj_3 and Sj_4 are executed on all theblocks in the current block when a MV predictor is updated in Step Sj_2.As a result, for example, inter predictor 126 determines the MVpredictor which yields the smallest cost as the MV at a control point ina motion estimation loop (Step Sj_5). At this time, inter predictor 126further encodes, in the stream, the difference value between thedetermined MV and the MV predictor as a MV difference. In other words,inter predictor 126 outputs the MV difference as a prediction parameterto entropy encoder 110 through prediction parameter generator 130.

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing motion compensation of the current block using thedetermined MV and the encoded reference picture (Step Sj_6).

It is to be noted that the above-described MV candidate list may begenerated in Step Sj_1. The MV candidate list may be, for example, alist including MV candidates derived using a plurality of MV derivationmethods for each control point. The plurality of MV derivation methodsmay be, for example, any combination of the MV derivation methodsillustrated in FIGS. 47A to 47C, the MV derivation methods illustratedin FIGS. 48A and 48B, the MV derivation methods illustrated in FIGS. 49Aand 49B, and other MV derivation methods.

It is to be noted that MV candidate lists may include MV candidates in amode in which prediction is performed in units of a sub-block, otherthan the affine mode.

It is to be noted that, for example, a MV candidate list including MVcandidates in an affine inter mode in which two control points are usedand an affine inter mode in which three control points are used may begenerated as a MV candidate list. Alternatively, a MV candidate listincluding MV candidates in the affine inter mode in which two controlpoints are used and a MV candidate list including MV candidates in theaffine inter mode in which three control points are used may begenerated separately. Alternatively, a MV candidate list including MVcandidates in one of the affine inter mode in which two control pointsare used and the affine inter mode in which three control points areused may be generated. The MV candidate(s) may be, for example, MVs forencoded block A (left), block B (upper), block C (upper-right), block D(lower-left), and block E (upper-left), or a MV for an effective blockamong the blocks.

It is to be noted that index indicating one of the MV candidates in a MVcandidate list may be transmitted as MV predictor selection information.

[MV Derivation>Triangle Mode]

Inter predictor 126 generates one rectangular prediction image for acurrent rectangular block in the above example. However, inter predictor126 may generate a plurality of prediction images each having a shapedifferent from a rectangle for the current rectangular block, and maycombine the plurality of prediction images to generate the finalrectangular prediction image. The shape different from a rectangle maybe, for example, a triangle.

FIG. 52A is a conceptual diagram for illustrating generation of twotriangular prediction images.

Inter predictor 126 generates a triangular prediction image byperforming motion compensation of a first partition having a triangularshape in a current block by using a first MV of the first partition, togenerate a triangular prediction image. Likewise, inter predictor 126generates a triangular prediction image by performing motioncompensation of a second partition having a triangular shape in acurrent block by using a second MV of the second partition, to generatea triangular prediction image. Inter predictor 126 then generates aprediction image having the same rectangular shape as the rectangularshape of the current block by combining these prediction images.

It is to be noted that a first prediction image having a rectangularshape corresponding to a current block may be generated as a predictionimage for a first partition, using a first MV. In addition, a secondprediction image having a rectangular shape corresponding to a currentblock may be generated as a prediction image for a second partition,using a second MV. A prediction image for the current block may begenerated by performing a weighted addition of the first predictionimage and the second prediction image. It is to be noted that the partwhich is subjected to the weighted addition may be a partial regionacross the boundary between the first partition and the secondpartition.

FIG. 52B is a conceptual diagram for illustrating examples of a firstportion of a first partition which overlaps with a second partition, andfirst and second sets of samples which may be weighted as part of acorrection process. The first portion may be, for example, one quarterof the width or height of the first partition. In another example, thefirst portion may have a width corresponding to N samples adjacent to anedge of the first partition, where N is an integer greater than zero,for example, N may be the integer 2. As illustrated, the left example ofFIG. 52B shows a rectangular partition having a rectangular portion witha width which is one fourth of the width of the first partition, withthe first set of samples including samples outside of the first portionand samples inside of the first portion, and the second set of samplesincluding samples within the first portion. The center example of FIG.52B shows a rectangular partition having a rectangular portion with aheight which is one fourth of the height of the first partition, withthe first set of samples including samples outside of the first portionand samples inside of the first portion, and the second set of samplesincluding samples within the first portion. The right example of FIG.52B shows a triangular partition having a polygonal portion with aheight which corresponds to two samples, with the first set of samplesincluding samples outside of the first portion and samples inside of thefirst portion, and the second set of samples including samples withinthe first portion.

The first portion may be a portion of the first partition which overlapswith an adjacent partition. FIG. 52C is a conceptual diagram forillustrating a first portion of a first partition, which is a portion ofthe first partition that overlaps with a portion of an adjacentpartition. For ease of illustration, a rectangular partition having anoverlapping portion with a spatially adjacent rectangular partition isshown. Partitions having other shapes, such as triangular partitions,may be employed, and the overlapping portions may overlap with aspatially or temporally adjacent partition.

In addition, although an example is given in which a prediction image isgenerated for each of two partitions using inter prediction, aprediction image may be generated for at least one partition using intraprediction.

FIG. 53 is a flow chart illustrating one example of a process in atriangle mode.

In the triangle mode, first, inter predictor 126 splits the currentblock into the first partition and the second partition (Step Sx_1). Atthis time, inter predictor 126 may encode, in a stream, partitioninformation which is information related to the splitting into thepartitions as a prediction parameter. In other words, inter predictor126 may output the partition information as the prediction parameter toentropy encoder 110 through prediction parameter generator 130.

First, inter predictor 126 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of encodedblocks temporally or spatially surrounding the current block (StepSx_2). In other words, inter predictor 126 generates a MV candidatelist.

Inter predictor 126 then selects the MV candidate for the firstpartition and the MV candidate for the second partition as a first MVand a second MV, respectively, from the plurality of MV candidatesobtained in Step Sx_1 (Step Sx_3). At this time, inter predictor 126encodes, in a stream, MV selection information for identifying theselected MV candidate as a prediction parameter. In other words, interpredictor 126 outputs the MV selection information as a predictionparameter to entropy encoder 110 through prediction parameter generator130.

Next, inter predictor 126 generates a first prediction image byperforming motion compensation using the selected first MV and anencoded reference picture (Step Sx_4). Likewise, inter predictor 126generates a second prediction image by performing motion compensationusing the selected second MV and an encoded reference picture (StepSx_5).

Lastly, inter predictor 126 generates a prediction image for the currentblock by performing a weighted addition of the first prediction imageand the second prediction image (Step Sx_6).

It is to be noted that, although the first partition and the secondpartition are triangles in the example illustrated in FIG. 52A, thefirst partition and the second partition may be trapezoids, or othershapes different from each other. Furthermore, although the currentblock includes two partitions in the examples illustrated in FIGS. 52Aand 52C, the current block may include three or more partitions.

In addition, the first partition and the second partition may overlapwith each other. In other words, the first partition and the secondpartition may include the same pixel region. In this case, a predictionimage for a current block may be generated using a prediction image inthe first partition and a prediction image in the second partition.

In addition, although the example in which the prediction image isgenerated for each of the two partitions using inter prediction has beenillustrated, a prediction image may be generated for at least onepartition using intra prediction.

It is to be noted that the MV candidate list for selecting the first MVand the MV candidate list for selecting the second MV may be differentfrom each other, or the MV candidate list for selecting the first MV maybe also used as the MV candidate list for selecting the second MV.

It is to be noted that partition information may include an indexindicating the splitting direction in which at least a current block issplit into a plurality of partitions. The MV selection information mayinclude an index indicating the selected first MV and an indexindicating the selected second MV. One index may indicate a plurality ofpieces of information. For example, one index collectively indicating apart or the entirety of partition information and a part or the entiretyof MV selection information may be encoded.

[MV Derivation>ATMVP Mode]

FIG. 54 is a conceptual diagram for illustrating one example of anAdvanced Temporal Motion Vector Prediction (ATMVP) mode in which a MV isderived in units of a sub-block.

The ATMVP mode is a mode categorized into the merge mode. For example,in the ATMVP mode, a MV candidate for each sub-block is registered in aMV candidate list for use in normal merge mode.

More specifically, in the ATMVP mode, first, as illustrated in FIG. 54 ,a temporal MV reference block associated with a current block isidentified in an encoded reference picture specified by a MV (MV0) of aneighboring block located at the lower-left position with respect to thecurrent block. Next, in each sub-block in the current block, the MV usedto encode the region corresponding to the sub-block in the temporal MVreference block is identified. The MV identified in this way is includedin a MV candidate list as a MV candidate for the sub-block in thecurrent block. When the MV candidate for each sub-block is selected fromthe MV candidate list, the sub-block is subjected to motion compensationin which the MV candidate is used as the MV for the sub-block. In thisway, a prediction image for each sub-block is generated.

Although the block located at the lower-left position with respect thecurrent block is used as a surrounding MV reference block in the exampleillustrated in FIG. 54 , it is to be noted that another block may beused. In addition, the size of the sub-block may be 4×4 pixels, 8×8pixels, or another size. The size of the sub-block may be switched for aunit such as a slice, brick, picture, etc.

[MV Derivation>DMVR]

FIG. 55 is a flow chart illustrating a relationship between the mergemode and Decoder Motion Vector Refinement DMVR.

Inter predictor 126 derives a motion vector for a current blockaccording to the merge mode (Step Sl_1). Next, inter predictor 126determines whether to perform estimation of a motion vector, that is,motion estimation (Step Sl_2). Here, when determining not to performmotion estimation (No in Step Sl_2), inter predictor 126 determines themotion vector derived in Step Sl_1 as the final motion vector for thecurrent block (Step Sl_4). In other words, in this case, the motionvector of the current block is determined according to the merge mode.

When determining to perform motion estimation in Step Sl_1 (Yes in StepSl_2), inter predictor 126 derives the final motion vector for thecurrent block by estimating a surrounding region of the referencepicture specified by the motion vector derived in Step Sl_1 (Step Sl_3).In other words, in this case, the motion vector of the current block isdetermined according to the DMVR.

FIG. 56 is a conceptual diagram for illustrating one example of a DMVRprocess for determining a MV.

First, in the merge mode for example, MV candidates (L0 and L1) areselected for the current block. A reference pixel is identified from afirst reference picture (L0) which is an encoded picture in the L0 listaccording to the MV candidate (L0). Likewise, a reference pixel isidentified from the second reference picture (L1) which is an encodedpicture in the L1 list according to the MV candidate (L1). A template isgenerated by calculating an average of these reference pixels.

Next, each of the surrounding regions of MV candidates of the firstreference picture (L0) and the second reference picture (L1) areestimated using the template, and the MV which yields the smallest costis determined to be the final MV. It is to be noted that the cost may becalculated, for example, using a difference value between each of thepixel values in the template and a corresponding one of the pixel valuesin the estimation region, the values of MV candidates, etc.

Exactly the same processes described here do not always need to beperformed. Other process for enabling derivation of the final MV byestimation in surrounding regions of MV candidates may be used.

FIG. 57 is a conceptual diagram for illustrating another example of DMVRfor determining a MV. Unlike the example of DMVR illustrated in FIG. 56, in the example illustrated in FIG. 57 , costs are calculated withoutgenerating a template.

First, inter predictor 126 estimates a surrounding region of a referenceblock included in each of reference pictures in the L0 list and L1 list,based on an initial MV which is a MV candidate obtained from each MVcandidate list. For example, as illustrated in FIG. 57 , the initial MVcorresponding to the reference block in the L0 list is InitMV_L0, andthe initial MV corresponding to the reference block in the L1 list isInitMV_L1. In motion estimation, inter predictor 126 first sets thesearch position for the reference picture in the L0 list. Based on theposition indicated by the vector difference indicating the searchposition to be set, specifically, the initial MV (that is, InitMV_L0,the vector difference to the search position is MVd_L0. Inter predictor126 then determines the estimation position in the reference picture inthe L1 list. This search position is indicated by the vector differenceto the search position from the position indicated by the initial MV(that is, InitMV_L1). More specifically, inter predictor 126 determinesthe vector difference as MVd_L1 by mirroring of MVd_L0. In other words,inter predictor 126 determines the position which is symmetrical withrespect to the position indicated by the initial MV to be the searchposition in each reference picture in the L0 list and the L1 list. Interpredictor 126 calculates, for each search position, the total sum of theabsolute differences (SADs) between values of pixels at search positionsin blocks as a cost, and finds out the search position that yields thesmallest cost.

FIG. 58A is a conceptual diagram for illustrating one example of motionestimation in DMVR, and FIG. 58B is a flow chart illustrating oneexample of a process of motion estimation.

First, in Step 1, inter predictor 126 calculates the cost between thesearch position (also referred to as a starting point) indicated by theinitial MV and eight surrounding search positions. Inter predictor 126then determines whether the cost at each of the search positions otherthan the starting point is the smallest. Here, when determining that thecost at the search position other than the starting point is thesmallest, inter predictor 126 changes a target to the search position atwhich the smallest cost is obtained, and performs the process in Step 2.When the cost at the starting point is the smallest, inter predictor 126skips the process in Step 2 and performs the process in Step 3.

In Step 2, inter predictor 126 performs the search similar to theprocess in Step 1, regarding, as a new starting point, the searchposition after the target change according to the result of the processin Step 1. Inter predictor 126 then determines whether the cost at eachof the search positions other than the starting point is the smallest.Here, when determining that the cost at the search position other thanthe starting point is the smallest, inter predictor 126 performs theprocess in Step 4. When the cost at the starting point is the smallest,inter predictor 126 performs the process in Step 3.

In Step 4, inter predictor 126 regards the search position at thestarting point as the final search position, and determines thedifference between the position indicated by the initial MV and thefinal search position to be a vector difference.

In Step 3, inter predictor 126 determines the pixel position atsub-pixel accuracy at which the smallest cost is obtained, based on thecosts at the four points located at upper, lower, left, and rightpositions with respect to the starting point in Step 1 or Step 2, andregards the pixel position as the final search position. The pixelposition at the sub-pixel accuracy is determined by performing weightedaddition of each of the four upper, lower, left, and right vectors ((0,1), (0, −1), (−1, 0), and (1, 0)), using, as a weight, the cost at acorresponding one of the four search positions. Inter predictor 126 thendetermines the difference between the position indicated by the initialMV and the final search position to be the vector difference.

[Motion Compensation>BIO/OBMC/LIC]

Motion compensation involves a mode for generating a prediction image,and correcting the prediction image. The mode is, for example,bi-directional optical flow (BIO), overlapped block motion compensation(OBMC), local illumination compensation (LIC), to be described later,etc.

FIG. 59 is a flow chart illustrating one example of a process ofgeneration of a prediction image.

Inter predictor 126 generates a prediction image (Step Sm_1), andcorrects the prediction image, for example, according to, for example,any of the modes described above (Step Sm_2).

FIG. 60 is a flow chart illustrating another example of a process ofgeneration of a prediction image.

Inter predictor 126 determines a motion vector of a current block (StepSn_1). Next, inter predictor 126 generates a prediction image using themotion vector (Step Sn_2), and determines whether to perform acorrection process (Step Sn_3). Here, when determining to perform acorrection process (Yes in Step Sn_3), inter predictor 126 generates thefinal prediction image by correcting the prediction image (Step Sn_4).It is to be noted that, in LIC described later, luminance andchrominance may be corrected in Step Sn_4. When determining not toperform a correction process (No in Step Sn_3), inter predictor 126outputs the prediction image as the final prediction image withoutcorrecting the prediction image (Step Sn_5).

[Motion Compensation>OBMC]

It is to be noted that an inter prediction image may be generated usingmotion information for a neighboring block in addition to motioninformation for the current block obtained by motion estimation. Morespecifically, an inter prediction image may be generated for eachsub-block in a current block by performing weighted addition of aprediction image based on the motion information obtained by motionestimation (in a reference picture) and a prediction image based on themotion information of the neighboring block (in the current picture).Such inter prediction (motion compensation) is also referred to asoverlapped block motion compensation (OBMC) or an OBMC mode.

In OBMC mode, information indicating a sub-block size for OBMC (referredto as, for example, an OBMC block size) may be signaled at the sequencelevel. Moreover, information indicating whether to apply the OBMC mode(referred to as, for example, an OBMC flag) may be signaled at the CUlevel. It is to be noted that the signaling of such information does notnecessarily need to be performed at the sequence level and CU level, andmay be performed at another level (for example, at the picture level,slice level, brick level, CTU level, or sub-block level).

The OBMC mode will be described in further detail. FIGS. 61 and 62 are aflow chart and a conceptual diagram for illustrating an outline of aprediction image correction process performed by OBMC.

First, as illustrated in FIG. 62 , a prediction image (Pred) by normalmotion compensation is obtained using a MV assigned to a current block.In FIG. 62 , the arrow “MV” points a reference picture, and indicateswhat the current block of the current picture refers to in order toobtain the prediction image.

Next, a prediction image (Pred_L) is obtained by applying a motionvector (MV_L) which has been already derived for the encoded blockneighboring to the left of the current block to the current block(re-using the motion vector for the current block). The motion vector(MV_L) is indicated by an arrow “MV_L” indicating a reference picturefrom a current block. A first correction of a prediction image isperformed by overlapping two prediction images Pred and Pred_L. Thisprovides an effect of blending the boundary between neighboring blocks.

Likewise, a prediction image (Pred_U) is obtained by applying a MV(MV_U) which has been already derived for the encoded block neighboringabove the current block to the current block (re-using the MV for thecurrent block). The MV (MV_U) is indicated by an arrow “MV_U” indicatinga reference picture from a current block. A second correction of aprediction image is performed by overlapping the prediction image Pred_Uto the prediction images (for example, Pred and Pred_L) on which thefirst correction has been performed. This provides an effect of blendingthe boundary between neighboring blocks. The prediction image obtainedby the second correction is the one in which the boundary between theneighboring blocks has been blended (smoothed), and thus is the finalprediction image of the current block. Although the above example is atwo-path correction method using left and upper neighboring blocks, itis to be noted that the correction method may be three- or more-pathcorrection method using also the right neighboring block and/or thelower neighboring block.

It is to be noted that the region in which such overlapping is performedmay be only part of a region near a block boundary instead of the pixelregion of the entire block.

It is to be noted that the prediction image correction process accordingto OBMC for obtaining one prediction image Pred from one referencepicture by overlapping additional prediction image Pred_L and Pred_Uhave been described above. However, when a prediction image is correctedbased on a plurality of reference images, a similar process may beapplied to each of the plurality of reference pictures. In such a case,after corrected prediction images are obtained from the respectivereference pictures by performing OBMC image correction based on theplurality of reference pictures, the obtained corrected predictionimages are further overlapped to obtain the final prediction image.

It is to be noted that, in OBMC, a current block unit may be a PU or asub-block unit obtained by further splitting the PU.

One example of a method for determining whether to apply OBMC is amethod for using an obmc_flag which is a signal indicating whether toapply OBMC. As one specific example, encoder 100 may determine whetherthe current block belongs to a region having complicated motion. Encoder100 sets the obmc_flag to a value of “1” when the block belongs to aregion having complicated motion and applies OBMC when encoding, andsets the obmc_flag to a value of “0” when the block does not belong to aregion having complicated motion and encodes the block without applyingOBMC. Decoder 200 switches between application and non-application ofOBMC by decoding the obmc_flag written in a stream.

[Motion Compensation>BIO]

Next, a MV derivation method is described. First, a mode for deriving aMV based on a model assuming uniform linear motion is described. Thismode is also referred to as a bi-directional optical flow (BIO) mode. Inaddition, this bi-directional optical flow may be written as BDOFinstead of BIO.

FIG. 63 is a conceptual diagram for illustrating a model assuminguniform linear motion. In FIG. 63 , (v_(x), v_(y)) indicates a velocityvector, and τ0 and τ1 indicate temporal distances between a currentpicture (Cur Pic) and two reference pictures (Ref0, Ref1). (MV_(x0),MV_(y0)) indicate MVs corresponding to reference picture Ref0, and(MV_(x1), MV_(y1)) indicate MVs corresponding to reference picture Ref₁.

Here, under the assumption of uniform linear motion exhibited by avelocity vector (v_(x), v_(y)), (MV_(x0), MV_(y0)) and (MV_(x1),MV_(y1)) are represented as (v_(xτ0), v_(yτ0)) and (−v_(xτ1), −v_(yτ1)),respectively, and the following optical flow equation (2) is given.[Math 2]∂I ^((k)) /∂t+v _(x) ∂I ^((k)) /∂x+v _(y) ∂I ^((k)) /∂y=0  (2)

Here, I(k) indicates a motion-compensated luma value of referencepicture k (k=0, 1) after motion compensation. This optical flow equationshows that the sum of (i) the time derivative of the luma value, (ii)the product of the horizontal velocity and the horizontal component ofthe spatial gradient of a reference image, and (iii) the product of thevertical velocity and the vertical component of the spatial gradient ofa reference image is equal to zero. A motion vector of each blockobtained from, for example, a MV candidate list may be corrected inunits of a pixel, based on a combination of the optical flow equationand Hermite interpolation.

It is to be noted that a motion vector may be derived on the decoderside 200 using a method other than deriving a motion vector based on amodel assuming uniform linear motion. For example, a motion vector maybe derived in units of a sub-block based on motion vectors of aplurality of neighboring blocks.

FIG. 64 is a flow chart illustrating one example of a process of interprediction according to BIO. FIG. 65 is a functional block diagramillustrating one example of a functional configuration of interpredictor 126 which may perform inter prediction according to BIO.

As illustrated in FIG. 65 , inter predictor 126 includes, for example,memory 126 a, interpolated image deriver 126 b, gradient image deriver126 c, optical flow deriver 126 d, correction value deriver 126 e, andprediction image corrector 126 f. It is to be noted that memory 126 amay be frame memory 122.

Inter predictor 126 derives two motion vectors (M₀, M₁), using tworeference pictures (Ref₀, Ref₁) different from the picture (Cur Pic)including a current block. Inter predictor 126 then derives a predictionimage for the current block using the two motion vectors (M₀, M₁) (StepSy_1). It is to be noted that motion vector M₀ is motion vector(MV_(x0), MV_(y0)) corresponding to reference picture Ref₀, and motionvector M₁ is motion vector (MV_(x1), MV_(y1)) corresponding to referencepicture Ref₁.

Next, interpolated image deriver 126 b derives interpolated image I⁰ forthe current block, using motion vector M₀ and reference picture L₀ byreferring to memory 126 a. Next, interpolated image deriver 126 bderives interpolated image I¹ for the current block, using motion vectorM₁ and reference picture L₁ by referring to memory 126 a (Step Sy_2).Here, interpolated image I⁰ is an image included in reference pictureRef₀ and to be derived for the current block, and interpolated image I¹is an image included in reference picture Ref₁ and to be derived for thecurrent block. Each of interpolated image I⁰ and interpolated image I¹may be the same in size as the current block. Alternatively, each ofinterpolated image I⁰ and interpolated image I¹ may be an image largerthan the current block. Furthermore, interpolated image I⁰ andinterpolated image I¹ may include a prediction image obtained by usingmotion vectors (M₀, M₁) and reference pictures (L₀, L₁) and applying amotion compensation filter.

In addition, gradient image deriver 126 c derives gradient images (Ix⁰,Ix¹, Iy⁰, Iy¹) of the current block, from interpolated image I⁰ andinterpolated image I¹ (Step Sy_3). It is to be noted that the gradientimages in the horizontal direction are (Ix⁰, Ix¹), and the gradientimages in the vertical direction are (Iy⁰, Iy¹). Gradient image deriver126 c may derive each gradient image by, for example, applying agradient filter to the interpolated images. The gradient image mayindicate the amount of spatial change in pixel value along thehorizontal direction, along the vertical direction, or both.

Next, optical flow deriver 126 d derives, for each sub-block of thecurrent block, an optical flow (v_(x), v_(y)) which is a velocityvector, using the interpolated images (I⁰, I¹) and the gradient images(Ix⁰, Ix¹, Iy⁰, Iy¹) (Step Sy_4). The optical flow indicatescoefficients for correcting the amount of spatial pixel movement, andmay be referred to as a local motion estimation value, a correctedmotion vector, or a corrected weighting vector. As one example, asub-block may be 4×4 pixel sub-CU. It is to be noted that the opticalflow derivation may be performed for each pixel unit, or the like,instead of being performed for each sub-block.

Next, inter predictor 126 corrects a prediction image for the currentblock using the optical flow (v_(x), v_(y)). For example, correctionvalue deriver 126 e derives a correction value for the value of a pixelincluded in a current block, using the optical flow (v_(x), v_(y)) (StepSy_5). Prediction image corrector 126 f may then correct the predictionimage for the current block using the correction value (Step Sy_6). Itis to be noted that the correction value may be derived in units of apixel, or may be derived in units of a plurality of pixels or in unitsof a sub-block.

It is to be noted that the BIO process flow is not limited to theprocess disclosed in FIG. 64 . For example, only part of the processesdisclosed in FIG. 64 may be performed, or a different process may beadded or used as a replacement, or the processes may be executed in adifferent processing order, etc.

[Motion Compensation>LIC]

Next, one example of a mode for generating a prediction image(prediction) using a local illumination compensation (LIC) process isdescribed.

FIG. 66A is a conceptual diagram for illustrating one example of processof a prediction image generation method using a luminance correctionprocess performed by LIC. FIG. 66B is a flow chart illustrating oneexample of a process of prediction image generation method using theLIC.

First, inter predictor 126 derives a MV from an encoded referencepicture, and obtains a reference image corresponding to the currentblock (Step Sz_1).

Next, inter predictor 126 extracts, for the current block, informationindicating how the luma value has changed between the current block andthe reference picture (Step Sz_2). This extraction is performed based onthe luma pixel values of the encoded left neighboring reference region(surrounding reference region) and the encoded upper neighboringreference region (surrounding reference region) in the current picture,and the luma pixel values at the corresponding positions in thereference picture specified by the derived MVs. Inter predictor 126calculates a luminance correction parameter, using the informationindicating how the luma value has changed (Step Sz_3).

Inter predictor 126 generates a prediction image for the current blockby performing a luminance correction process in which the luminancecorrection parameter is applied to the reference image in the referencepicture specified by the MV (Step Sz_4). In other words, the predictionimage which is the reference image in the reference picture specified bythe MV is subjected to the correction based on the luminance correctionparameter. In this correction, luminance may be corrected, orchrominance may be corrected, or both. In other words, a chrominancecorrection parameter may be calculated using information indicating howchrominance has changed, and a chrominance correction process may beperformed.

It is to be noted that the shape of the surrounding reference regionillustrated in FIG. 66A is one example; another shape may be used.

Moreover, although the process in which a prediction image is generatedfrom a single reference picture has been described here, cases in whicha prediction image is generated from a plurality of reference picturescan be described in the same manner. The prediction image may begenerated after performing a luminance correction process of thereference images obtained from the reference pictures in the same manneras described above.

One example of a method for determining whether to apply LIC is a methodfor using a lic_flag which is a signal indicating whether to apply theLIC. As one specific example, encoder 100 determines whether the currentblock belongs to a region having a luminance change. Encoder 100 setsthe lic_flag to a value of “1” when the block belongs to a region havinga luminance change and applies LIC when encoding, and sets the lic_flagto a value of “0” when the block does not belong to a region having aluminance change and performs encoding without applying LIC. Decoder 200may decode the lic_flag written in the stream and decode the currentblock by switching between application and non-application of LIC inaccordance with the flag value.

One example of a different method of determining whether to apply a LICprocess is a determining method in accordance with whether a LIC processhas been applied to a surrounding block. As one specific example, when acurrent block has been processed in merge mode, inter predictor 126determines whether an encoded surrounding block selected in MVderivation in merge mode has been encoded using LIC. Inter predictor 126performs encoding by switching between application and non-applicationof LIC according to the result. It is to be noted that, also in thisexample, the same processes are applied in processes at the decoder 200side.

The luminance correction (LIC) process has been described with referenceto FIGS. 66A and 66B, and is further described below.

First, inter predictor 126 derives a MV for obtaining a reference imagecorresponding to a current block to be encoded from a reference picturewhich is an encoded picture.

Next, inter predictor 126 extracts information indicating how the lumavalue of the reference picture has been changed to the luma value of thecurrent picture, using the luma pixel values of encoded surroundingreference regions which neighbor to the left of and above the currentblock and the luma values in the corresponding positions in thereference pictures specified by MVs, and calculates a luminancecorrection parameter. For example, it is assumed that the luma pixelvalue of a given pixel in the surrounding reference region in thecurrent picture is p0, and that the luma pixel value of the pixelcorresponding to the given pixel in the surrounding reference region inthe reference picture is p1. Inter predictor 126 calculates coefficientsA and B for optimizing A×p1+B=p0 as the luminance correction parameterfor a plurality of pixels in the surrounding reference region.

Next, inter predictor 126 performs a luminance correction process usingthe luminance correction parameter for the reference image in thereference picture specified by the MV, to generate a prediction imagefor the current block. For example, it is assumed that the luma pixelvalue in the reference image is p2, and that the luminance-correctedluma pixel value of the prediction image is p3. Inter predictor 126generates the prediction image after being subjected to the luminancecorrection process by calculating A×p2+B=p3 for each of the pixels inthe reference image.

For example, a region having a determined number of pixels extractedfrom each of an upper neighboring pixel and a left neighboring pixel maybe used as a surrounding reference region. In addition, the surroundingreference region is not limited to a region which neighbors the currentblock, and may be a region which does not neighbor the current block. Inthe example illustrated in FIG. 66A, the surrounding reference region inthe reference picture may be a region specified by another MV in acurrent picture, from a surrounding reference region in the currentpicture. For example, the other MV may be a MV in a surroundingreference region in the current picture.

Although operations performed by encoder 100 have been described here,it is to be noted that decoder 200 performs similar operations.

It is to be noted that LIC may be applied not only to luma but also tochroma. At this time, a correction parameter may be derived individuallyfor each of Y, Cb, and Cr, or a common correction parameter may be usedfor any of Y, Cb, and Cr.

In addition, the LIC process may be applied in units of a sub-block. Forexample, a correction parameter may be derived using a surroundingreference region in a current sub-block and a surrounding referenceregion in a reference sub-block in a reference picture specified by a MVof the current sub-block.

[Prediction Controller]

Prediction controller 128 selects one of an intra prediction signal (animage or a signal output from intra predictor 124) and an interprediction signal (an image or a signal output from inter predictor126), and outputs the selected prediction image to subtractor 104 andadder 116 as a prediction signal.

[Prediction Parameter Generator]

Prediction parameter generator 130 may output information related tointra prediction, inter prediction, selection of a prediction image inprediction controller 128, etc. as a prediction parameter to entropyencoder 110. Entropy encoder 110 may generate a stream, based on theprediction parameter which is input from prediction parameter generator130 and quantized coefficients which are input from quantizer 108. Theprediction parameter may be used in decoder 200. Decoder 200 may receiveand decode the stream, and perform the same processes as the predictionprocesses performed by intra predictor 124, inter predictor 126, andprediction controller 128. The prediction parameter may include, forexample, (i) a selection prediction signal (for example, a MV, aprediction type, or a prediction mode used by intra predictor 124 orinter predictor 126), or (ii) an optional index, a flag, or a valuewhich is based on a prediction process performed in each of intrapredictor 124, inter predictor 126, and prediction controller 128, orwhich indicates the prediction process.

[Decoder]

Next, decoder 200 capable of decoding a stream output from encoder 100described above is described. FIG. 67 is a block diagram illustrating afunctional configuration of decoder 200 according to this embodiment.Decoder 200 is an apparatus which decodes a stream that is an encodedimage in units of a block.

As illustrated in FIG. 67 , decoder 200 includes entropy decoder 202,inverse quantizer 204, inverse transformer 206, adder 208, block memory210, loop filter 212, frame memory 214, intra predictor 216, interpredictor 218, prediction controller 220, prediction parameter generator222, and splitting determiner 224. It is to be noted that intrapredictor 216 and inter predictor 218 are configured as part of aprediction executor.

[Mounting Example of Decoder]

FIG. 68 is a functional block diagram illustrating a mounting example ofdecoder 200. Decoder 200 includes processor b1 and memory b2. Forexample, the plurality of constituent elements of decoder 200illustrated in FIG. 67 are mounted on processor b1 and memory b2illustrated in FIG. 68 .

Processor b1 is circuitry which performs information processing and iscoupled to memory b2. For example, processor b1 is a dedicated orgeneral electronic circuit which decodes a stream. Processor b1 may be aprocessor such as a CPU. In addition, processor b1 may be an aggregateof a plurality of electronic circuits. In addition, for example,processor b1 may take the roles of two or more constituent elementsother than a constituent element for storing information out of theplurality of constituent elements of decoder 200 illustrated in FIG. 67, etc.

Memory b2 is dedicated or general memory for storing information that isused by processor b1 to decode a stream. Memory b2 may be electroniccircuitry, and may be connected to processor b1. In addition, memory b2may be included in processor b1. In addition, memory b2 may be anaggregate of a plurality of electronic circuits. In addition, memory b2may be a magnetic disc, an optical disc, or the like, or may berepresented as a storage, a recording medium, or the like. In addition,memory b2 may be a non-volatile memory, or a volatile memory.

For example, memory b2 may store an image or a stream. In addition,memory b2 may store a program for causing processor b1 to decode astream.

In addition, for example, memory b2 may take the roles of two or moreconstituent elements for storing information out of the plurality ofconstituent elements of decoder 200 illustrated in FIG. 67 , etc. Morespecifically, memory b2 may take the roles of block memory 210 and framememory 214 illustrated in FIG. 67 . More specifically, memory b2 maystore a reconstructed image (specifically, a reconstructed block, areconstructed picture, or the like).

It is to be noted that, in decoder 200, not all of the plurality ofconstituent elements illustrated in FIG. 67 , etc. may be implemented,and not all the processes described herein may be performed. Part of theconstituent elements indicated in FIG. 67 , etc. may be included inanother device, or part of the processes described herein may beperformed by another device.

Hereinafter, an overall flow of the processes performed by decoder 200is described, and then each of the constituent elements included indecoder 200 is described. It is to be noted that, some of theconstituent elements included in decoder 200 perform the same processesas performed by some of encoder 100, and thus the same processes are notrepeatedly described in detail. For example, inverse quantizer 204,inverse transformer 206, adder 208, block memory 210, frame memory 214,intra predictor 216, inter predictor 218, prediction controller 220, andloop filter 212 included in decoder 200 perform similar processes asperformed by inverse quantizer 112, inverse transformer 114, adder 116,block memory 118, frame memory 122, intra predictor 124, inter predictor126, prediction controller 128, and loop filter 120 included in decoder200, respectively.

[Overall Flow of Decoding Process].

FIG. 69 is a flow chart illustrating one example of an overall decodingprocess performed by decoder 200.

First, splitting determiner 224 in decoder 200 determines a splittingpattern of each of a plurality of fixed-size blocks (128×128 pixels)included in a picture, based on a parameter which is input from entropydecoder 202 (Step Sp_1). This splitting pattern is a splitting patternselected by encoder 100. Decoder 200 then performs processes of StepSp_2 to Sp_6 for each of a plurality of blocks of the splitting pattern.

Entropy decoder 202 decodes (specifically, entropy decodes) encodedquantized coefficients and a prediction parameter of a current block(Step Sp_2).

Next, inverse quantizer 204 performs inverse quantization of theplurality of quantized coefficients and inverse transformer 206 performsinverse transform of the result, to restore prediction residuals (thatis, a difference block) (Step Sp_3).

Next, the prediction executor including all or part of intra predictor216, inter predictor 218, and prediction controller 220 generates aprediction signal of the current block (Step Sp_4).

Next, adder 208 adds the prediction image to a prediction residual togenerate a reconstructed image (also referred to as a decoded imageblock) of the current block (Step Sp_5).

When the reconstructed image is generated, loop filter 212 performsfiltering of the reconstructed image (Step Sp_6).

Decoder 200 then determines whether decoding of the entire picture hasbeen finished (Step Sp_7). When determining that the decoding has notyet been finished (No in Step Sp_7), decoder 200 repeats to theprocesses starting with Step Sp_1.

It is to be noted that the processes of these Steps Sp_1 to Sp_7 may beperformed sequentially by decoder 200, or two or more of the processesmay be performed in parallel. The processing order of the two or more ofthe processes may be modified.

[Splitting Determiner]

FIG. 70 is a conceptual diagram for illustrating a relationship betweensplitting determiner 224 and other constituent elements in anembodiment. Splitting determiner 224 may perform the following processesas examples.

For example, splitting determiner 224 collects block information fromblock memory 210 or frame memory 214, and furthermore obtains aparameter from entropy decoder 202. Splitting determiner 224 may thendetermine the splitting pattern of a fixed-size block, based on theblock information and the parameter. Splitting determiner 224 may thenoutput the information indicating the determined splitting pattern toinverse transformer 206, intra predictor 216, and inter predictor 218.Inverse transformer 206 may perform inverse transform of transformcoefficients, based on the splitting pattern indicated by theinformation from splitting determiner 224. Intra predictor 216 and interpredictor 218 may generate a prediction image, based on the splittingpattern indicated by the information from splitting determiner 224.

[Entropy Decoder]

FIG. 71 is a block diagram illustrating one example of a functionalconfiguration of entropy decoder 202.

Entropy decoder 202 generates quantized coefficients, a predictionparameter, and a parameter related to a splitting pattern, by entropydecoding the stream. For example, CABAC is used in the entropy decoding.More specifically, entropy decode 202 includes, for example, binaryarithmetic decoder 202 a, context controller 202 b, and debinarizer 202c. Binary arithmetic decoder 202 a arithmetically decodes the streamusing a context value derived by context controller 202 b to a binarysignal. Context controller 202 b derives a context value according to afeature or a surrounding state of a syntax element, that is anoccurrence probability of a binary signal, in the same manner asperformed by context controller 110 b of encoder 100. Debinarizer 202 cperforms debinarization for transforming the binary signal output frombinary arithmetic decoder 202 a to a multi-level signal indicatingquantized coefficients as described above. This binarization may beperformed according to the binarization method described above.

With this, entropy decoder 202 outputs quantized coefficients of eachblock to inverse quantizer 204. Entropy decoder 202 may output aprediction parameter included in a stream (see FIG. 1 ) to intrapredictor 216, inter predictor 218, and prediction controller 220. Intrapredictor 216, inter predictor 218, and prediction controller 220 arecapable of executing the same prediction processes as those performed byintra predictor 124, inter predictor 126, and prediction controller 128at the encoder 100 side.

FIG. 72 is a conceptual diagram for illustrating a flow of an exampleCABAC process in entropy decoder 202.

First, initialization is performed in CABAC in entropy decoder 202. Inthe initialization, initialization in binary arithmetic decoder 202 aand setting of an initial context value are performed. Binary arithmeticdecoder 202 a and debinarizer 202 c then execute arithmetic decoding anddebinarization of, for example, encoded data of a CTU. At this time,context controller 202 b updates the context value each time arithmeticdecoding is performed. Context controller 202 b then saves the contextvalue as a post process. The saved context value is used, for example,to initialize the context value for the next CTU.

[Inverse Quantizer]

Inverse quantizer 204 inverse quantizes quantized coefficients of acurrent block which are inputs from entropy decoder 202. Morespecifically, inverse quantizer 204 inverse quantizes the quantizedcoefficients of the current block, based on quantization parameterscorresponding to the quantized coefficients. Inverse quantizer 204 thenoutputs the inverse quantized transform coefficients (that are transformcoefficients) of the current block to inverse transformer 206.

FIG. 73 is a block diagram illustrating one example of a functionalconfiguration of inverse quantizer 204.

Inverse quantizer 204 includes, for example, quantization parametergenerator 204 a, predicted quantization parameter generator 204 b,quantization parameter storage 204 d, and inverse quantization executor204 e.

FIG. 74 is a flow chart illustrating one example of a process of inversequantization performed by inverse quantizer 204.

Inverse quantizer 204 may perform an inverse quantization process as oneexample for each CU based on the flow illustrated in FIG. 74 . Morespecifically, quantization parameter generator 204 a determines whetherto perform inverse quantization (Step Sv_11). Here, when determining toperform inverse quantization (Yes in Step Sv_11), quantization parametergenerator 204 a obtains a difference quantization parameter for thecurrent block from entropy decoder 202 (Step Sv_12).

Next, predicted quantization parameter generator 204 b then obtains aquantization parameter for a processing unit different from the currentblock from quantization parameter storage 204 d (Step Sv_13). Predictedquantization parameter generator 204 b generates a predictedquantization parameter of the current block based on the obtainedquantization parameter (Step Sv_14).

Quantization parameter generator 204 a then generates a quantizationparameter for the current block based on the difference quantizationparameter for the current block obtained from entropy decoder 202 andthe predicted quantization parameter for the current block generated bypredicted quantization parameter generator 204 b (Step Sv_15). Forexample, the difference quantization parameter for the current blockobtained from entropy decoder 202 and the predicted quantizationparameter for the current block generated by predicted quantizationparameter generator 204 b may be added together to generate thequantization parameter for the current block. In addition, quantizationparameter generator 204 a stores the quantization parameter for thecurrent block in quantization parameter storage 204 d (Step Sv_16).

Next, inverse quantization executor 204 e inverse quantizes thequantized coefficients of the current block into transform coefficients,using the quantization parameter generated in Step Sv_15 (Step Sv_17).

It is to be noted that the difference quantization parameter may bedecoded at the bit sequence level, picture level, slice level, bricklevel, or CTU level. In addition, the initial value of the quantizationparameter may be decoded at the sequence level, picture level, slicelevel, brick level, or CTU level. At this time, the quantizationparameter may be generated using the initial value of the quantizationparameter and the difference quantization parameter.

It is to be noted that inverse quantizer 204 may include a plurality ofinverse quantizers, and may inverse quantize the quantized coefficientsusing an inverse quantization method selected from a plurality ofinverse quantization methods.

[Inverse Transformer]

Inverse transformer 206 restores prediction residuals by inversetransforming the transform coefficients which are inputs from inversequantizer 204.

For example, when information parsed from a stream indicates that EMT orAMT is to be applied (for example, when an AMT flag is true), inversetransformer 206 inverse transforms the transform coefficients of thecurrent block based on information indicating the decoded transformtype.

Moreover, for example, when information parsed from a stream indicatesthat NSST is to be applied, inverse transformer 206 applies a secondaryinverse transform to the transform coefficients.

FIG. 75 is a flow chart illustrating one example of a process performedby inverse transformer 206.

For example, inverse transformer 206 determines whether informationindicating that no orthogonal transform is performed is present in astream (Step St_11). Here, when determining that no such information ispresent (No in Step St_11) (e.g.: the absence of any indication as towhether an orthogonal transform is performed; the presence of anindication that an orthogonal transform is to be performed); inversetransformer 206 obtains the information indicating the transform typedecoded by entropy decoder 202 (Step St_12). Next, based on theinformation, inverse transformer 206 determines the transform type usedfor the orthogonal transform in encoder 100 (Step St_13). Inversetransformer 206 then performs inverse orthogonal transform using thedetermined transform type (Step St_14). As illustrated in FIG. 75 , whendetermining that information indicating that no orthogonal transform isperformed is present (Yes in Step St_11) (e.g., an express indicationthat no orthogonal transform is performed; the absence of an indicationan orthogonal transform is performed), no orthogonal transform isperformed.

FIG. 76 is a flow chart illustrating one example of a process performedby inverse transformer 206.

For example, inverse transformer 206 determines whether a transform sizeis smaller than or equal to a determined value (Step Su_11). Thedetermined value may be predetermined. Here, when determining that thetransform size is smaller than or equal to a determined value (Yes inStep Su_11), inverse transformer 206 obtains, from entropy decoder 202,information indicating which transform type has been used by encoder 100among the at least one transform type included in the first transformtype group (Step Su 12). It is to be noted that such information isdecoded by entropy decoder 202 and output to inverse transformer 206.

Based on the information, inverse transformer 206 determines thetransform type used for the orthogonal transform in encoder 100 (StepSu_13). Inverse transformer 206 then inverse orthogonal transforms thetransform coefficients of the current block using the determinedtransform type (Step Su_14). When determining that a transform size isnot smaller than or equal to the determined value (No in Step Su_11),inverse transformer 206 inverse transforms the transform coefficients ofthe current block using the second transform type group (Step Su_15).

It is to be noted that the inverse orthogonal transform by inversetransformer 206 may be performed according to the flow illustrated inFIG. 75 or FIG. 76 for each TU as one example. In addition, inverseorthogonal transform may be performed by using a defined transform typewithout decoding information indicating a transform type used fororthogonal transform. The defined transform type may be a predefinedtransform type or a default transform type. In addition, the transformtype may be specifically DST7, DCT8, or the like. In an inverseorthogonal transform, an inverse transform basis function correspondingto the transform type is used.

[Adder]

Adder 208 reconstructs the current block by adding a prediction residualwhich is an input from inverse transformer 206 and a prediction imagewhich is an input from prediction controller 220. In other words, areconstructed image of the current block is generated. Adder 208 thenoutputs the reconstructed image of the current block to block memory 210and loop filter 212.

[Block Memory]

Block memory 210 is storage for storing a block which is included in acurrent picture and may be referred to in intra prediction. Morespecifically, block memory 210 stores a reconstructed image output fromadder 208.

[Loop Filter]

Loop filter 212 applies a loop filter to the reconstructed imagegenerated by adder 208, and outputs the filtered reconstructed image toframe memory 214 and provides an output of the decoder 200, e.g., andoutput to a display device, etc.

When information indicating ON or OFF of an ALF parsed from a streamindicates that an ALF is ON, one filter from among a plurality offilters may be selected, for example, based on the direction andactivity of local gradients, and the selected filter is applied to thereconstructed image.

FIG. 77 is a block diagram illustrating one example of a functionalconfiguration of loop filter 212. It is to be noted that loop filter 212has a configuration similar to the configuration of loop filter 120 ofencoder 100.

For example, as illustrated in FIG. 77 , loop filter 212 includesdeblocking filter executor 212 a, SAO executor 212 b, and ALF executor212 c. Deblocking filter executor 212 a performs a deblocking filterprocess on the reconstructed image. SAO executor 212 b performs a SAOprocess on the reconstructed image after being subjected to thedeblocking filter process. ALF executor 212 c performs an ALF process onthe reconstructed image after being subjected to the SAO process. It isto be noted that loop filter 212 does not always need to include all theconstituent elements disclosed in FIG. 77 , and may include only part ofthe constituent elements. In addition, loop filter 212 may be configuredto perform the above processes in a processing order different from theone disclosed in FIG. 77 , may not perform all of the processesillustrated in FIG. 77 , etc.

[Frame Memory]

Frame memory 214 is, for example, storage for storing reference picturesfor use in inter prediction, and may also be referred to as a framebuffer. More specifically, frame memory 214 stores a reconstructed imagefiltered by loop filter 212.

[Predictor (Intra Predictor, Inter Predictor, Prediction Controller)]

FIG. 78 is a flow chart illustrating one example of a process performedby a predictor of decoder 200. It is to be noted that the predictionexecutor may include all or part of the following constituent elements:intra predictor 216; inter predictor 218; and prediction controller 220.The prediction executor includes, for example, intra predictor 216 andinter predictor 218.

The predictor generates a prediction image of a current block (StepSq_1). This prediction image is also referred to as a prediction signalor a prediction block. It is to be noted that the prediction signal is,for example, an intra prediction signal or an inter prediction signal.More specifically, the predictor generates the prediction image of thecurrent block using a reconstructed image which has been alreadyobtained for another block through generation of a prediction image,restoration of a prediction residual, and addition of a predictionimage. The predictor of decoder 200 generates the same prediction imageas the prediction image generated by the predictor of encoder 100. Inother words, the prediction images are generated according to a methodcommon between the predictors or mutually corresponding methods.

The reconstructed image may be, for example, an image in a referencepicture, or an image of a decoded block (that is, the other blockdescribed above) in a current picture which is the picture including thecurrent block. The decoded block in the current picture is, for example,a neighboring block of the current block.

FIG. 79 is a flow chart illustrating another example of a processperformed by the predictor of decoder 200.

The predictor determines either a method or a mode for generating aprediction image (Step Sr_1). For example, the method or mode may bedetermined based on, for example, a prediction parameter, etc.

When determining a first method as a mode for generating a predictionimage, the predictor generates a prediction image according to the firstmethod (Step Sr_2 a). When determining a second method as a mode forgenerating a prediction image, the predictor generates a predictionimage according to the second method (Step Sr_2 b). When determining athird method as a mode for generating a prediction image, the predictorgenerates a prediction image according to the third method (Step Sr_2c).

The first method, the second method, and the third method may bemutually different methods for generating a prediction image. Each ofthe first to third methods may be an inter prediction method, an intraprediction method, or another prediction method. The above-describedreconstructed image may be used in these prediction methods. FIGS. 80Ato 80C (collectively, FIG. 80 ) are a flow chart illustrating anotherexample of a process performed by a predictor of decoder 200.

The predictor may perform a prediction process according to the flowillustrated in FIG. 80 as one example. It is to be noted that intrablock copy illustrated in FIG. 80 is one mode which belongs to interprediction, and in which a block included in a current picture isreferred to as a reference image or a reference block. In other words, apicture different from the current picture is not referred to in intrablock copy. In addition, the PCM mode illustrated in FIG. 80 is one modewhich belongs to intra prediction, and in which no transform andquantization is performed.

[Intra Predictor]

Intra predictor 216 performs intra prediction by referring to a block ina current picture stored in block memory 210, based on the intraprediction mode parsed from the stream, to generate a prediction imageof a current block (that is, an intra prediction block). Morespecifically, intra predictor 216 performs intra prediction by referringto pixel values (for example, luma and/or chroma values) of a block orblocks neighboring the current block to generate an intra predictionimage, and then outputs the intra prediction image to predictioncontroller 220.

It is to be noted that when an intra prediction mode in which a lumablock is referred to in intra prediction of a chroma block is selected,intra predictor 216 may predict the chroma component of the currentblock based on the luma component of the current block.

Moreover, when information parsed from a stream indicates that PDPC isto be applied, intra predictor 216 corrects intra predicted pixel valuesbased on horizontal/vertical reference pixel gradients.

FIG. 81 is a diagram illustrating one example of a process performed byintra predictor 216 of decoder 200.

Intra predictor 216 first determines whether an MPM is to be employed.As illustrated in FIG. 81 , intra predictor 216 determines whether anMPM flag indicating 1 is present in the stream (Step Sw_11). Here, whendetermining that the MPM flag indicating 1 is present (Yes in StepSw_11), intra predictor 216 obtains, from entropy decoder 202,information indicating the intra prediction mode selected in encoder 100among MPMs. It is to be noted that such information is decoded byentropy decoder 202 and output to intra predictor 216. Next, intrapredictor 216 determines the MPMs (Step Sw_13). MPMs include, forexample, six intra prediction modes. Intra predictor 216 then determinesthe intra prediction mode which is included in a plurality of intraprediction modes included in the MPMs and is indicated by theinformation obtained in Step Sw_12 (Step Sw_14).

When determining that no MPM flag indicating 1 is present (No in StepSw_11), intra predictor 216 obtains information indicating the intraprediction mode selected in encoder 100 (Step Sw_15). In other words,intra predictor 216 obtains, from entropy decoder 202, informationindicating the intra prediction mode selected in encoder 100 from amongthe at least one intra prediction mode which is not included in theMPMs. It is to be noted that such information is decoded by entropydecoder 202 and output to intra predictor 216. Intra predictor 216 thendetermines the intra prediction mode which is not included in aplurality of intra prediction modes included in the MPMs and isindicated by the information obtained in Step Sw_15 (Step Sw_17).

Intra predictor 216 generates a prediction image according to the intraprediction mode determined in Step Sw_14 or Step Sw_17 (Step Sw_18).

[Inter Predictor]

Inter predictor 218 predicts the current block by referring to areference picture stored in frame memory 214. Prediction is performed inunits of a current block or a current sub-block in the current block. Itis to be noted that the sub-block is included in the block and is a unitsmaller than the block. The size of the sub-block may be 4×4 pixels, 8×8pixels, or another size. The size of the sub-block may be switched for aunit such as a slice, brick, picture, etc.

For example, inter predictor 218 generates an inter prediction image ofa current block or a current sub-block by performing motion compensationusing motion information (for example, a MV) parsed from a stream (forexample, a prediction parameter output from entropy decoder 202), andoutputs the inter prediction image to prediction controller 220.

When the information parsed from the stream indicates that the OBMC modeis to be applied, inter predictor 218 generates the inter predictionimage using motion information of a neighboring block in addition tomotion information of the current block obtained through motionestimation.

Moreover, when the information parsed from the stream indicates that theFRUC mode is to be applied, inter predictor 218 derives motioninformation by performing motion estimation in accordance with a patternmatching method (e.g., bilateral matching or template matching) parsedfrom the stream. Inter predictor 218 then performs motion compensation(prediction) using the derived motion information.

Moreover, when the BIO mode is to be applied, inter predictor 218derives a MV based on a model assuming uniform linear motion. Inaddition, when the information parsed from the stream indicates that theaffine mode is to be applied, inter predictor 218 derives a MV for eachsub-block, based on the MVs of a plurality of neighboring blocks.

[MV Derivation Flow]

FIG. 82 is a flow chart illustrating one example of a process of MVderivation in decoder 200.

Inter predictor 218 determines, for example, whether to decode motioninformation (for example, a MV). For example, inter predictor 218 maymake the determination according to the prediction mode included in thestream, or may make the determination based on other informationincluded in the stream. Here, when determining to decode motioninformation, inter predictor 218 derives a MV for a current block in amode in which the motion information is decoded. When determining not todecode motion information, inter predictor 218 derives a MV in a mode inwhich no motion information is decoded.

Here, MV derivation modes include a normal inter mode, a normal mergemode, a FRUC mode, an affine mode, etc. which are described later. Modesin which motion information is decoded among the modes include thenormal inter mode, the normal merge mode, the affine mode (specifically,an affine inter mode and an affine merge mode), etc. It is to be notedthat motion information may include not only a MV but also MV predictorselection information which is described later. Modes in which no motioninformation is decoded include the FRUC mode, etc. Inter predictor 218selects a mode for deriving a MV for the current block from theplurality of modes, and derives the MV for the current block using theselected mode.

FIG. 83 is a flow chart illustrating one example of a process of MVderivation in decoder 200.

For example, inter predictor 218 may determine whether to decode a MVdifference, that is for example, may make the determination according tothe prediction mode included in the stream, or may make thedetermination based on other information included in the stream. Here,when determining to decode a MV difference, inter predictor 218 mayderive a MV for a current block in a mode in which the MV difference isdecoded. In this case, for example, the MV difference included in thestream is decoded as a prediction parameter.

When determining not to decode any MV difference, inter predictor 218derives a MV in a mode in which no MV difference is decoded. In thiscase, no encoded MV difference is included in the stream.

Here, as described above, the MV derivation modes include the normalinter mode, the normal merge mode, the FRUC mode, the affine mode, etc.which are described later. Modes in which a MV difference is encodedamong the modes include the normal inter mode and the affine mode(specifically, the affine inter mode), etc. Modes in which no MVdifference is encoded include the FRUC mode, the normal merge mode, theaffine mode (specifically, the affine merge mode), etc. Inter predictor218 selects a mode for deriving a MV for the current block from theplurality of modes, and derives the MV for the current block using theselected mode.

[MV Derivation>Normal Inter Mode]

For example, when information parsed from a stream indicates that thenormal inter mode is to be applied, inter predictor 218 derives a MVbased on the information parsed from the stream and performs motioncompensation (prediction) using the MV.

FIG. 84 is a flow chart illustrating an example of a process of interprediction by normal inter mode in decoder 200.

Inter predictor 218 of decoder 200 performs motion compensation for eachblock. First, inter predictor 218 obtains a plurality of MV candidatesfor a current block based on information such as MVs of a plurality ofdecoded blocks temporally or spatially surrounding the current block(Step Sg_11). In other words, inter predictor 218 generates a MVcandidate list.

Next, inter predictor 218 extracts N (an integer of 2 or larger) MVcandidates from the plurality of MV candidates obtained in Step Sg_11,as motion vector predictor candidates (also referred to as MV predictorcandidates) according to the determined ranks in priority order (StepSg_12). It is to be noted that the ranks in priority order may bedetermined in advance for the respective N MV predictor candidates andmay be predetermined.

Next, inter predictor 218 decodes the MV predictor selection informationfrom the input stream, and selects one MV predictor candidate from the NMV predictor candidates as the MV predictor for the current block usingthe decoded MV predictor selection information (Step Sg_13).

Next, inter predictor 218 decodes a MV difference from the input stream,and derives a MV for the current block by adding a difference valuewhich is the decoded MV difference and the selected MV predictor (StepSg_14).

Lastly, inter predictor 218 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the decoded reference picture (Step Sg_15). The processesin Steps Sg_11 to Sg_15 are executed on each block. For example, whenthe processes in Steps Sg_11 to Sg_15 are executed on each of all theblocks in the slice, inter prediction of the slice using the normalinter mode finishes. For example, when the processes in Steps Sg_11 toSg_15 are executed on each of all the blocks in the picture, interprediction of the picture using the normal inter mode finishes. It is tobe noted that not all the blocks included in the slice may be subjectedto the processes in Steps Sg_11 to Sg_15, and inter prediction of theslice using the normal inter mode may finish when part of the blocks aresubjected to the processes. This also applies to pictures in Steps Sg_11to Sg_15. Inter prediction of the picture using the normal inter modemay finish when the processes are executed on part of the blocks in thepicture.

[MV Derivation>Normal Merge Mode]

For example, when information parsed from a stream indicates that thenormal merge mode is to be applied, inter predictor 218 derives a MV andperforms motion compensation (prediction) using the MV.

FIG. 85 is a flow chart illustrating an example of a process of interprediction by normal merge mode in decoder 200.

First, inter predictor 218 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of decodedblocks temporally or spatially surrounding the current block (StepSh_11). In other words, inter predictor 218 generates a MV candidatelist.

Next, inter predictor 218 selects one MV candidate from the plurality ofMV candidates obtained in Step Sh_11, deriving a MV for the currentblock (Step Sh_12). More specifically, inter predictor 218 obtains MVselection information included as a prediction parameter in a stream,and selects the MV candidate identified by the MV selection informationas the MV for the current block.

Lastly, inter predictor 218 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the decoded reference picture (Step Sh_13). The processesin Steps Sh_11 to Sh_13 are executed, for example, on each block. Forexample, when the processes in Steps Sh_11 to Sh_13 are executed on eachof all the blocks in the slice, inter prediction of the slice using thenormal merge mode finishes. In addition, when the processes in StepsSh_11 to Sh_13 are executed on each of all the blocks in the picture,inter prediction of the picture using the normal merge mode finishes. Itis to be noted that not all the blocks included in the slice aresubjected to the processes in Steps Sh_11 to Sh_13, and inter predictionof the slice using the normal merge mode may finish when part of theblocks are subjected to the processes. This also applies to pictures inSteps Sh_11 to Sh_13. Inter prediction of the picture using the normalmerge mode may finish when the processes are executed on part of theblocks in the picture.

[MV Derivation>FRUC Mode]

For example, when information parsed from a stream indicates that theFRUC mode is to be applied, inter predictor 218 derives a MV in the FRUCmode and performs motion compensation (prediction) using the MV. In thiscase, the motion information is derived at the decoder 200 side withoutbeing signaled from the encoder 100 side. For example, decoder 200 mayderive the motion information by performing motion estimation. In thiscase, decoder 200 performs motion estimation without using any pixelvalues in a current block.

FIG. 86 is a flow chart illustrating an example of a process of interprediction by FRUC mode in decoder 200.

First, inter predictor 218 generates a list indicating MVs of decodedblocks spatially or temporally neighboring the current block byreferring to the MVs as MV candidates (the list is a MV candidate list,and may, for example, be used also as a MV candidate list for normalmerge mode (Step Si_11). Next, a best MV candidate is selected from theplurality of MV candidates registered in the MV candidate list (StepSi_12). For example, inter predictor 218 calculates the evaluation valueof each MV candidate included in the MV candidate list, and selects oneof the MV candidates as the best MV candidate based on the evaluationvalues. Based on the selected best MV candidates, inter predictor 218then derives a MV for the current block (Step Si_14). More specifically,for example, the selected best MV candidates are directly derived as theMV for the current block. In addition, for example, the MV for thecurrent block may be derived using pattern matching in a surroundingregion of a position which is included in a reference picture andcorresponds to the selected best MV candidate. In other words,estimation using the pattern matching in a reference picture and theevaluation values may be performed in the surrounding region of the bestMV candidate, and when there is a MV that yields a better evaluationvalue, the best MV candidate may be updated to the MV that yields thebetter evaluation value, and the updated MV may be determined as thefinal MV for the current block. In an embodiment, updating to a MV thatyields a better evaluation value may not be performed.

Lastly, inter predictor 218 generates a prediction image for the currentblock by performing motion compensation of the current block using thederived MV and the decoded reference picture (Step Si_15). The processesin Steps Si_11 to Si_15 are executed, for example, on each block. Forexample, when the processes in Steps Si_11 to Si_15 are executed on eachof all the blocks in the slice, inter prediction of the slice using theFRUC mode finishes. For example, when the processes in Steps Si_11 toSi_15 are executed on each of all the blocks in the picture, interprediction of the picture using the FRUC mode finishes. Each sub-blockmay be processed similarly to the case of each block.

[MV Derivation>FRUC Mode]

For example, when information parsed from a stream indicates that theaffine merge mode is to be applied, inter predictor 218 derives a MV inthe affine merge mode and performs motion compensation (prediction)using the MV.

FIG. 87 is a flow chart illustrating an example of a process of interprediction by the affine merge mode in decoder 200.

In the affine merge mode, first, inter predictor 218 derives MVs atrespective control points for a current block (Step Sk_11). The controlpoints are an upper-left corner point of the current block and anupper-right corner point of the current block as illustrated in FIG.46A, or an upper-left corner point of the current block, an upper-rightcorner point of the current block, and a lower-left corner point of thecurrent block as illustrated in FIG. 46B.

For example, when the MV derivation methods illustrated in FIGS. 47A to47C are used, as illustrated in FIG. 47A, inter predictor 218 checksdecoded block A (left), block B (upper), block C (upper-right), block D(lower-left), and block E (upper-left) in this order, and identifies thefirst effective block decoded according to the affine mode. Interpredictor 218 derives the MV at the control point using the identifiedfirst effective block decoded according to the affine mode. For example,when block A is identified and block A has two control points, asillustrated in FIG. 47B, inter predictor 218 calculates motion vector v₀at the upper-left corner control point of the current block and motionvector v₁ at the upper-right corner control point of the current blockfrom motion vectors v₃ and v₄ at the upper-left corner and theupper-right corner of the decoded block including block A. In this way,the MV at each control point is derived.

It is to be noted that, as illustrated in FIG. 49A, MVs at three controlpoints may be calculated when block A is identified and block A has twocontrol points, and that, as illustrated in FIG. 49B, MVs at two controlpoints may be calculated when block A is identified and when block A hasthree control points.

In addition, when MV selection information is included as a predictionparameter in a stream, inter predictor 218 may derive the MV at eachcontrol point for the current block using the MV selection information.

Next, inter predictor 218 performs motion compensation of each of aplurality of sub-blocks included in the current block. In other words,inter predictor 218 calculates a MV for each of a plurality ofsub-blocks as an affine MV, using either two motion vectors v₀ and v₁and the above expression (1A) or three motion vectors v₀, v₁, and v₂ andthe above expression (1B) (Step Sk_12). Inter predictor 218 thenperforms motion compensation of the sub-blocks using these affine MVsand decoded reference pictures (Step Sk_13). When the processes in StepsSk_12 and Sk_13 are executed for each of the sub-blocks included in thecurrent block, the inter prediction using the affine merge mode for thecurrent block finishes. In other words, motion compensation of thecurrent block is performed to generate a prediction image of the currentblock.

It is to be noted that the above-described MV candidate list may begenerated in Step Sk_11. The MV candidate list may be, for example, alist including MV candidates derived using a plurality of MV derivationmethods for each control point. The plurality of MV derivation methodsmay, for example, be any combination of the MV derivation methodsillustrated in FIGS. 47A to 47C, the MV derivation methods illustratedin FIGS. 48A and 48B, the MV derivation methods illustrated in FIGS. 49Aand 49B, and other MV derivation methods.

It is to be noted that a MV candidate list may include MV candidates ina mode in which prediction is performed in units of a sub-block, otherthan the affine mode.

It is to be noted that, for example, a MV candidate list including MVcandidates in an affine merge mode in which two control points are usedand an affine merge mode in which three control points are used may begenerated as a MV candidate list. Alternatively, a MV candidate listincluding MV candidates in the affine merge mode in which two controlpoints are used and a MV candidate list including MV candidates in theaffine merge mode in which three control points are used may begenerated separately. Alternatively, a MV candidate list including MVcandidates in one of the affine merge mode in which two control pointsare used and the affine merge mode in which three control points areused may be generated.

[MV Derivation>Affine Inter Mode]

For example, when information parsed from a stream indicates that theaffine inter mode is to be applied, inter predictor 218 derives a MV inthe affine inter mode and performs motion compensation (prediction)using the MV.

FIG. 88 is a flow chart illustrating an example of a process of interprediction by the affine inter mode in decoder 200.

In the affine inter mode, first, inter predictor 218 derives MVpredictors (v₀, v₁) or (v₀, v₁, v₂) of respective two or three controlpoints for a current block (Step Sj_11). The control points are anupper-left corner point of the current block, an upper-right cornerpoint of the current block, and a lower-left corner point of the currentblock as illustrated in FIG. 46A or FIG. 46B.

Inter predictor 218 obtains MV predictor selection information includedas a prediction parameter in the stream, and derives the MV predictor ateach control point for the current block using the MV identified by theMV predictor selection information. For example, when the MV derivationmethods illustrated in FIGS. 48A and 48B are used, inter predictor 218derives the motion vector predictors (v₀, v₁) or (v₀, v₁, v₂) at controlpoints for the current block by selecting the MV of the block identifiedby the MV predictor selection information among decoded blocks in thevicinity of the respective control points for the current blockillustrated in either FIG. 48A or FIG. 48B.

Next, inter predictor 218 obtains each MV difference included as aprediction parameter in the stream, and adds the MV predictor at eachcontrol point for the current block and the MV difference correspondingto the MV predictor (Step Sj_12). In this way, the MV at each controlpoint for the current block is derived.

Next, inter predictor 218 performs motion compensation of each of theplurality of sub-blocks included in the current block. In other words,inter predictor 218 calculates a MV for each of a plurality ofsub-blocks as an affine MV, using either two motion vectors v₀ and v₁and the above expression (1A) or three motion vectors v₀, v₁, and v₂ andthe above expression (1B) (Step Sj_13). Inter predictor 218 thenperforms motion compensation of the sub-blocks using these affine MVsand decoded reference pictures (Step Sj_14). When the processes in StepsSj_13 and Sj_14 are executed for each of the sub-blocks included in thecurrent block, the inter prediction using the affine merge mode for thecurrent block finishes. In other words, motion compensation of thecurrent block is performed to generate a prediction image of the currentblock.

It is to be noted that the above-described MV candidate list may begenerated in Step Sj_11 as in Step Sk_11.

[MV Derivation>Triangle Mode]

For example, when information parsed from a stream indicates that thetriangle mode is to be applied, inter predictor 218 derives a MV in thetriangle mode and performs motion compensation (prediction) using theMV.

FIG. 89 is a flow chart illustrating an example of a process of interprediction by the triangle mode in decoder 200.

In the triangle mode, first, inter predictor 218 splits the currentblock into the first partition and the second partition (Step Sx_11).For example, inter predictor 218 may obtain, from the stream, partitioninformation which is information related to the splitting as aprediction parameter. Inter predictor 218 may then split a current blockinto a first partition and a second partition according to the partitioninformation.

Next, inter predictor 218 obtains a plurality of MV candidates for acurrent block based on information such as MVs of a plurality of decodedblocks temporally or spatially surrounding the current block (StepSx_12). In other words, inter predictor 218 generates a MV candidatelist.

Inter predictor 218 then selects the MV candidate for the firstpartition and the MV candidate for the second partition as a first MVand a second MV, respectively, from the plurality of MV candidatesobtained in Step Sx_11 (Step Sx_13). At this time, inter predictor 218may obtain, from the stream, MV selection information for identifyingeach selected MV candidate as a prediction parameter. Inter predictor218 may then select the first MV and the second MV according to the MVselection information.

Next, inter predictor 218 generates a first prediction image byperforming motion compensation using the selected first MV and a decodedreference picture (Step Sx_14). Likewise, inter predictor 218 generatesa second prediction image by performing motion compensation using theselected second MV and a decoded reference picture (Step Sx_15).

Lastly, inter predictor 218 generates a prediction image for the currentblock by performing a weighted addition of the first prediction imageand the second prediction image (Step Sx_16).

[MV Estimation>DMVR]

For example, information parsed from a stream indicates that DMVR is tobe applied, inter predictor 218 performs motion estimation using DMVR.

FIG. 90 is a flow chart illustrating an example of a process of motionestimation by DMVR in decoder 200.

Inter predictor 218 derives a MV for a current block according to themerge mode (Step Sl_11). Next, inter predictor 218 derives the final MVfor the current block by searching the region surrounding the referencepicture indicated by the MV derived in Sl_11 (Step Sl_12). In otherwords, in this case, the MV of the current block is determined accordingto the DMVR.

FIG. 91 is a flow chart illustrating an example of a process of motionestimation by DMVR in decoder 200, and is the same as FIG. 58B.

First, in Step 1 illustrated in FIG. 58A, inter predictor 218 calculatesthe cost between the search position (also referred to as a startingpoint) indicated by the initial MV and eight surrounding searchpositions. Inter predictor 218 then determines whether the cost at eachof the search positions other than the starting point is the smallest.Here, when determining that the cost at one of the search positionsother than the starting point is the smallest, inter predictor 218changes a target to the search position at which the smallest cost isobtained, and performs the process in Step 2 illustrated in FIG. 58 .When the cost at the starting point is the smallest, inter predictor 218skips the process in Step 2 illustrated in FIG. 58A and performs theprocess in Step 3.

In Step 2 illustrated in FIG. 58A, inter predictor 218 performs searchsimilar the process in Step 1, regarding the search position after thetarget change as new starting point according to the result of theprocess in Step 1. Inter predictor 218 then determines whether the costat each of the search positions other than the starting point is thesmallest. Here, when determining that the cost at one of the searchpositions other than the starting point is the smallest, inter predictor218 performs the process in Step 4. When the cost at the starting pointis the smallest, inter predictor 218 performs the process in Step 3.

In Step 4, inter predictor 218 regards the search position at thestarting point as the final search position, and determines thedifference between the position indicated by the initial MV and thefinal search position to be a vector difference.

In Step 3 illustrated in FIG. 58A, inter predictor 218 determines thepixel position at sub-pixel accuracy at which the smallest cost isobtained, based on the costs at the four points located at upper, lower,left, and right positions with respect to the starting point in Step 1or Step 2, and regards the pixel position as the final search position.

The pixel position at the sub-pixel accuracy is determined by performingweighted addition of each of the four upper, lower, left, and rightvectors ((0, 1), (0, −1), (−1, 0), and (1, 0)), using, as a weight, thecost at a corresponding one of the four search positions. Interpredictor 218 then determines the difference between the positionindicated by the initial MV and the final search position to be thevector difference.

[Motion Compensation>BIO/OBMC/LIC]

For example, when information parsed from a stream indicates thatcorrection of a prediction image is to be performed, upon generating aprediction image, inter predictor 218 corrects the prediction imagebased on the mode for the correction. The mode is, for example, one ofBIO, OBMC, and LIC described above.

FIG. 92 is a flow chart illustrating one example of a process ofgeneration of a prediction image in decoder 200.

Inter predictor 218 generates a prediction image (Step Sm_11), andcorrects the prediction image according to any of the modes describedabove (Step Sm_12).

FIG. 93 is a flow chart illustrating another example of a process ofgeneration of a prediction image in decoder 200.

Inter predictor 218 derives a MV for a current block (Step Sn_11). Next,inter predictor 218 generates a prediction image using the MV (StepSn_12), and determines whether to perform a correction process (StepSn_13). For example, inter predictor 218 obtains a prediction parameterincluded in the stream, and determines whether to perform a correctionprocess based on the prediction parameter. This prediction parameter is,for example, a flag indicating whether one or more of theabove-described modes is to be applied. Here, when determining toperform a correction process (Yes in Step Sn_13), inter predictor 218generates the final prediction image by correcting the prediction image(Step Sn_14). It is to be noted that, in LIC, luminance and chrominancemay be corrected in Step Sn_14. When determining not to perform acorrection process (No in Step Sn_13), inter predictor 218 outputs thefinal prediction image without correcting the prediction image (StepSn_15).

[Motion Compensation>OBMC]

For example, when information parsed from a stream indicates that OBMCis to be performed, upon generating a prediction image, inter predictor218 corrects the prediction image according to the OBMC.

FIG. 94 is a flow chart illustrating an example of a process ofcorrection of a prediction image by OBMC in decoder 200. It is to benoted that the flow chart in FIG. 94 indicates the correction flow of aprediction image using the current picture and the reference pictureillustrated in FIG. 62 .

First, as illustrated in FIG. 62 , inter predictor 218 obtains aprediction image (Pred) by normal motion compensation using a MVassigned to the current block.

Next, inter predictor 218 obtains a prediction image (Pred_L) byapplying a motion vector (MV_L) which has been already derived for thedecoded block neighboring to the left of the current block to thecurrent block (re-using the motion vector for the current block). Interpredictor 218 then performs a first correction of a prediction image byoverlapping two prediction images Pred and Pred_L. This provides aneffect of blending the boundary between neighboring blocks.

Likewise, inter predictor 218 obtains a prediction image (Pred_U) byapplying a MV (MV_U) which has been already derived for the decodedblock neighboring above the current block to the current block (re-usingthe motion vector for the current block). Inter predictor 218 thenperforms a second correction of a prediction image by overlapping theprediction image Pred_U to the prediction images (for example, Pred andPred_L) on which the first correction has been performed. This providesan effect of blending the boundary between neighboring blocks. Theprediction image obtained by the second correction is the one in whichthe boundary between the neighboring blocks has been blended (smoothed),and thus is the final prediction image of the current block.

[Motion Compensation>BIO]

For example, when information parsed from a stream indicates that BIO isto be performed, upon generating a prediction image, inter predictor 218corrects the prediction image according to the BIO.

FIG. 95 is a flow chart illustrating an example of a process ofcorrection of a prediction image by the BIO in decoder 200.

As illustrated in FIG. 63 , inter predictor 218 derives two motionvectors (M₀, M₁), using two reference pictures (Ref₀, Ref₁) differentfrom the picture (Cur Pic) including a current block. Inter predictor218 then derives a prediction image for the current block using the twomotion vectors (M₀, M₁) (Step Sy_11). It is to be noted that motionvector M₀ is a motion vector (MV_(x0), MV_(y0)) corresponding toreference picture Ref₀, and motion vector M₁ is a motion vector(MV_(x1), MV_(y1)) corresponding to reference picture Ref₁.

Next, inter predictor 218 derives interpolated image I⁰ for the currentblock using motion vector M₀ and reference picture L₀. In addition,inter predictor 218 derives interpolated image I¹ for the current blockusing motion vector M₁ and reference picture L₁ (Step Sy_12). Here,interpolated image I⁰ is an image included in reference picture Ref₀ andto be derived for the current block, and interpolated image I¹ is animage included in reference picture Ref₁ and to be derived for thecurrent block. Each of interpolated image I⁰ and interpolated image I¹may be the same in size as the current block. Alternatively, each ofinterpolated image I⁰ and interpolated image I¹ may be an image largerthan the current block. Furthermore, interpolated image I⁰ andinterpolated image I¹ may include a prediction image obtained by usingmotion vectors (M₀, M₁) and reference pictures (L₀, L₁) and applying amotion compensation filter.

In addition, inter predictor 218 derives gradient images (Ix⁰, Ix¹, Iy⁰,Iy¹) of the current block, from interpolated image I⁰ and interpolatedimage I¹ (Step Sy_13). It is to be noted that the gradient images in thehorizontal direction are (Ix⁰, Ix¹), and the gradient images in thevertical direction are (Iy⁰, Iy¹). Inter predictor 218 may derive thegradient images by, for example, applying a gradient filter to theinterpolated images. The gradient images may be the ones each of whichindicates the amount of spatial change in pixel value along thehorizontal direction or the amount of spatial change in pixel valuealong the vertical direction.

Next, inter predictor 218 derives, for each sub-block of the currentblock, an optical flow (v_(x), v_(y)) which is a velocity vector, usingthe interpolated images (I⁰, I¹) and the gradient images (Ix⁰, Ix¹, Iy⁰,Iy¹) (Step Sy_14). As one example, a sub-block may be 4×4 pixel sub-CU.

Next, inter predictor 218 corrects a prediction image for the currentblock using the optical flow (v_(x), v_(y)). For example, interpredictor 218 derives a correction value for the value of a pixelincluded in a current block, using the optical flow (v_(x), v_(y)) (StepSy_15). Inter predictor 218 may then correct the prediction image forthe current block using the correction value (Step Sy_16). It is to benoted that the correction value may be derived in units of a pixel, ormay be derived in units of a plurality of pixels or in units of asub-block, etc.

It is to be noted that the BIO process flow is not limited to theprocess disclosed in FIG. 95 . Only part of the processes disclosed inFIG. 95 may be performed, or a different process may be added or used asa replacement, or the processes may be executed in a differentprocessing order.

[Motion Compensation>LIC]

For example, when information parsed from a stream indicates that LIC isto be performed, upon generating a prediction image, inter predictor 218corrects the prediction image according to the LIC.

FIG. 96 is a flow chart illustrating an example of a process ofcorrection of a prediction image by the LIC in decoder 200.

First, inter predictor 218 obtains a reference image corresponding to acurrent block from a decoded reference picture using a MV (Step Sz_11).

Next, inter predictor 218 extracts, for the current block, informationindicating how the luminance value has changed between the currentpicture and the reference picture (Step Sz_12). This extraction may beperformed based on the luma pixel values for the decoded leftneighboring reference region (surrounding reference region) and thedecoded upper neighboring reference region (surrounding referenceregion), and the luma pixel values at the corresponding positions in thereference picture specified by the derived MVs. Inter predictor 218calculates a luminance correction parameter, using the informationindicating how the luma value changed (Step Sz_13).

Inter predictor 218 generates a prediction image for the current blockby performing a luminance correction process in which the luminancecorrection parameter is applied to the reference image in the referencepicture specified by the MV (Step Sz_14). In other words, the predictionimage which is the reference image in the reference picture specified bythe MV is subjected to the correction based on the luminance correctionparameter. In this correction, luminance may be corrected, orchrominance may be corrected.

[Prediction Controller]

Prediction controller 220 selects an intra prediction image or an interprediction image, and outputs the selected image to adder 208. As awhole, the configurations, functions, and processes of predictioncontroller 220, intra predictor 216, and inter predictor 218 at thedecoder 200 side may correspond to the configurations, functions, andprocesses of prediction controller 128, intra predictor 124, and interpredictor 126 at the encoder 100 side.

[First Example of Encoding Process or Decoding Process UsingQuantization Matrices]

FIG. 97 illustrates a first example of a flow of an encoding processusing quantization matrices (QMs) performed by encoder 100. Note thatencoder 100 described herein performs the encoding process for each ofsquare and rectangular blocks obtained by partitioning a picture(hereinafter also referred to as a screen) included in moving pictures.

First, quantizer 108 generates a square block QM in step S101. A squareblock QM is a quantization matrix for transform coefficients of a squareblock. Hereinafter, a square block QM is also referred to as a firstquantization matrix. Quantizer 108 may generate a square block QM fromvalues that are set for encoder 100 by a user or adaptively generate asquare block QM using coding information of a picture that has alreadybeen encoded. Entropy encoder 110 may write, into a stream, a signalrelated to the square block QM generated by quantizer 108. In this case,the square block QM may be encoded into any one of the following areasin the stream: a sequence header area; a picture header area; a sliceheader area; a supplemental information area; and an area for storingother parameters. Note that the square block QM need not be written intothe stream. In this case, quantizer 108 may use values in a square blockQM which are defined by default in standards. Moreover, entropy encoder110 may write, into the stream, not all of the matrix coefficients(quantized coefficients) of a square block QM, but only one or morequantized coefficients required for generating the square block QM. Thismakes it possible to reduce the amount of information to be encoded.

Subsequently, in step S102, quantizer 108 generates a rectangular blockQM using the square block QM generated in step S101. A rectangular blockQM is a quantization matrix for transform coefficients of a rectangularblock. Hereinafter, a rectangular block QM is also referred to as asecond quantization matrix. Note that entropy encoder 110 does not writethe rectangular block QM signal into the stream.

The processes in steps S101 and S102 may be performed all at once whensequence processing, picture processing, or slice processing is started,or one or more of processes in per-block processing may be performedevery time. In steps S101 and S102, quantizer 108 may generate pluraltypes of QMs for blocks of the same size, according to conditions suchas whether a QM is generated for a luma block or a chroma block, or foran intra picture prediction block or an inter picture prediction block,and any other condition.

Next, a loop performed on a per block basis is started. First, in stepS103, intra predictor 124 or inter predictor 126 performs prediction ona per block basis using, for instance, intra picture prediction or interpicture prediction. Subsequently, in step S104, transformer 106 performstransformation using, for instance, a discrete cosine transform (DCT) ona prediction residual image that has been generated. Then, in step S105,quantizer 108 performs, on transform coefficients that have beengenerated, quantization using the square block QM and the rectangularblock QM that are outputs resulting from the processes in steps S101 andS102, respectively. In inter picture prediction, a mode for referring toa block in a picture to which a current block belongs may be usedtogether with a mode for referring to a block in a picture differentfrom a picture to which a current block belongs. In this case, an interpicture prediction QM may be commonly used for the both modes or anintra picture prediction QM may be used for the mode for referring to ablock in a picture to which a current block belongs. Furthermore, instep S106, inverse quantizer 112 inverse quantizes the quantizedtransform coefficients using the square block QM and the rectangularblock QM that are outputs resulting from the processes in steps S101 andS102, respectively. In step S107, inverse transformer 114 generates aresidual (prediction error) image by inverse transforming the inversequantized transform coefficients. Subsequently, in step S108, adder 116generates a reconstructed image by adding the residual image to aprediction image. After repeating this processing flow, the loopperformed on a per block basis is ended.

This enables encoding even with an encoding method for current blocksincluding various rectangular blocks, by writing into a stream not arectangular block QM having a different shape, but only a square blockQM. In other words, with encoder 100 according to the first aspect ofthe present disclosure, it is possible to reduce a load for encoding aheader area since a rectangular block QM is not written into the stream.Moreover, with encoder 100 according to the first aspect of the presentdisclosure, it is possible to generate a rectangular block QM from asquare block QM, and this in turn makes it possible to use anappropriate QM even for a rectangular block without increasing a loadfor encoding a header area. Accordingly, with encoder 100 according tothe first aspect of the present disclosure, it is possible toeffectively quantize rectangular blocks having various shapes, andtherefore it is highly possible to improve coding efficiency. Note thatthe square block QM need not be written into the stream, and values in asquare block QM which are defined by default in standards may be used.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

FIG. 98 illustrates an example of a flow of a decoding process usingquantization matrices (QMs) performed by decoder 200 corresponding toencoder 100 described with reference to FIG. 97 . Decoder 200 describedherein performs the decoding process for each of square and rectangularblocks obtained by partitioning a screen.

First, in step S201, entropy decoder 202 decodes, from a stream, asignal related to a square block QM, and generates the square block QMusing the decoded signal. Note that the square block QM may be decodedfrom any one of the following areas in the stream: a sequence headerarea; a picture header area; a slice header area; a supplementalinformation area; and an area for storing other parameters. Moreover,the square block QM need not be decoded from the stream. In this case,values defined by default in standards may be used as a square block QM.Entropy decoder 202 may decode, from the stream, not all of quantizedcoefficients of a square block QM, but only one or more quantizedcoefficients required for generating the square block QM, to generatethe QM.

Subsequently, in step S202, entropy decoder 202 generates a rectangularblock QM using the square block QM generated in step S201. Note thatentropy decoder 202 does not decode a rectangular block QM signal fromthe stream.

The processes in steps S201 and S202 may be performed all at once whensequence processing, picture processing, or slice processing is started,or one or more of processes in per-block processing may be performedevery time. In steps S201 and S202, entropy decoder 202 may generateplural types of QMs for blocks of the same size, according to conditionssuch as whether a QM is generated for a luma or chroma block, or for anintra picture prediction block or an inter picture prediction block, andany other condition.

Next, a loop performed on a per block basis is started. First, in stepS203, intra predictor 216 or inter predictor 218 performs prediction ona per block basis using, for instance, intra picture prediction or interpicture prediction. Subsequently, in step S204, inverse quantizer 204inverse quantizes the quantized transform coefficients that have beendecoded from the stream, using the square block QM and the rectangularblock QM that are outputs resulting from the processes in steps S201 andS202, respectively. In inter picture prediction, a mode for referring toa block in a picture to which a current block belongs may be usedtogether with a mode for referring to a block in a picture differentfrom a picture to which a current block belongs. In this case, an interpicture prediction QM may be commonly used for the both modes or anintra picture prediction QM may be used for the mode for referring to ablock in a picture to which a current block belongs. Subsequently, instep S205, inverse transformer 206 generates a residual (predictionerror) image by inverse transforming the inverse quantized transformcoefficients. Then, in step S206, adder 208 generates a reconstructedimage by adding the residual image to a prediction image. Afterrepeating this processing flow, the loop performed on a per block basisis ended.

This enables decoding even with a decoding method for current blocksincluding various rectangular blocks provided that only a square blockQM is written into a stream while a rectangular block QM having adifferent shape is not. In other words, with decoder 200 according tothe first aspect of the present disclosure, it is possible to reduce aload for encoding a header area since the rectangular block QM is notwritten into the stream. Moreover, with decoder 200 according to thefirst aspect of the present disclosure, it is possible to generate arectangular block QM from a square block QM, and this in turn makes itpossible to use an appropriate QM even for a rectangular block withoutincreasing a load for encoding a header area. Accordingly, with decoder200 according to the first aspect of the present disclosure, it ispossible to effectively quantize rectangular blocks having variousshapes, and therefore it is highly possible to improve codingefficiency. Note that the square block QM need not be written into thestream, and a square block QM which is defined by default in standardsmay be used.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

[First Example of Method of Generating Rectangular Block QM in FirstExample]

FIG. 99 is a diagram for explaining a first example of generating arectangular block QM from a square block QM in step S102 in FIG. 97 orstep S202 in FIG. 98 . The processes described herein are commonlyperformed by encoder 100 and decoder 200.

In FIG. 99 , a square block having a size of from 2×2 to 256×256 isassociated with the sizes of a rectangular block QM to be generated froma square block QM having one of the aforementioned sizes. The exampleshown in FIG. 99 is characterized in that the length of the longer sideof each of the rectangular blocks equals to the length of a side of thecorresponding square block. Stated differently, the size of arectangular block which is a current block is smaller than the size of asquare block in this example. In other words, encoder 100 or decoder 200according to the first aspect of the present disclosure generates arectangular block QM by down-converting a square block QM having a sidewhose length is equal to the length of the longer side of a rectangularblock which is a current block.

FIG. 99 shows a correspondence relationship between a square block QMhaving a different block size and rectangular block QMs to be generatedfrom the corresponding square block QM, without differentiating the caseof referring to a luma block from the case of referring to a chromablock. A correspondence relationship between rectangular block QMs and asquare block QM which are compliant with a format to be actually usedmay be derived where necessary. In the case of using a 4:2:0 format, forexample, the size of a luma block is twice as large as that of a chromablock. Therefore, when a luma block is referred to in the process ofgenerating a rectangular block QM from a square block QM, the size of ausable square block QM is in the range of from 4×4 to 256×256. In thiscase, a rectangular block QM having a size such that the length of theshorter side is at least 4 and the length of the longer side is at most256 is only allowed to be used for a rectangular block QM to begenerated from a square block QM. When a chroma block is referred to inthe process of generating a rectangular block QM from a square block QM,the size of a usable square block QM is in the range of from 2×2 to128×128. In this case, a rectangular block QM having a size such thatthe length of the shorter side is at least 2 and the length of thelonger side is at most 128 is only allowed to be used for a rectangularblock QM to be generated from a square block QM.

In the case of using 4:4:4 format, for example, a luma block has thesame size as that of a chroma block. Therefore, when a chroma block isreferred to in the process of generating a rectangular block QM, thesize of a usable square block QM is in the range of from 4×4 to 256×256,as is the case of referring to a luma block.

Thus, it is desirable to derive, where necessary, a correspondencerelationship between a square block QM and rectangular block QMs,according to a format to be actually used.

The block sizes shown in FIG. 99 are mere examples and are not limitedto such. For example, a QM having a block size other than the blocksizes shown in FIG. 99 may be used or only one or more of the blocksizes shown in FIG. 99 may be used.

FIG. 100 is a diagram for explaining a method of generating arectangular block QM by down-converting the corresponding square blockQM, which is described with reference to FIG. 99 .

In the example shown in FIG. 100 , an 8×4 rectangular block QM isgenerated from an 8×8 square block QM.

In the down-conversion, matrix elements in a square block QM may bedivided into groups that are identical in number to matrix elements in arectangular block QM. In each of the groups, matrix elements included inthe group may be sequentially placed in a horizontal direction or in avertical direction of a square block. For each of the groups, (i) amatrix element located at a lowest frequency domain among the matrixelements included in the group, (ii) a matrix element located at ahighest frequency domain among the matrix elements included in thegroup, or (iii) an average value of the matrix elements included in thegroup may be determined as a matrix element corresponding to the groupin the rectangular block QM.

For example, in FIG. 100 , matrix elements in an 8×8 square block QM isenclosed per a determined number by a thick line. The determined numberof matrix elements enclosed by the thick line constitute one group. Thedetermined number of matrix elements may be predetermined. In thedown-conversion shown in FIG. 100 , the 8×8 square block QM is dividedinto groups so that the number of the groups is equal to the number ofmatrix elements (also referred to as quantized coefficients) in arectangular block QM to be generated from the 8×8 square block QM. Inthe example shown in FIG. 100 , two quantized coefficients neighboringin an up-and-down direction constitute one group. Subsequently, aquantized coefficient located in the lowest frequency domain (the upperside in the example in FIG. 100 ) in each group in the 8×8 square blockQM is selected and determined as a value of the 8×4 rectangular blockQM.

A method of selecting, from each group, one quantized coefficient as avalue in a rectangular block QM is not limited to the above example, anda different method may be used. For example, a quantized coefficientlocated in the highest frequency domain or in an intermediate frequencydomain within a group may be determined as a value in a rectangularblock QM. Alternatively, an average value, the smallest value, thelargest value, or a median value of all, or one or more of quantizedcoefficients in a group may be used. When decimal occurs as a result ofcalculation of these values, a resultant value may be rounded up, down,or to the nearest integer.

A method of selecting one quantized coefficient from each group in asquare block QM may be switched from one to another according to afrequency domain at which the group is located in the square block QM.For example, a quantized coefficient located at the lowest frequencydomain in a group may be selected when the group is located in a lowfrequency domain, a quantized coefficient located at the highestfrequency domain in a group may be selected when the group is located ina high frequency domain, or a quantized coefficient located in anintermediate frequency domain in a group may be selected when the groupis located in the intermediate frequency domain.

The lowest frequency component (the most upper left quantizedcoefficient in the example in FIG. 100 ) in a rectangular block QM to begenerated may be written into a stream and thus directly set in thestream, instead of being derived from a square block QM. In such a case,an increase in the amount of information to be written into the streammight increase a load for encoding a header area, but allows a directcontrol of the quantized coefficient of the lowest frequency componentthat has the greatest influence on image quality, and it is thereforehighly possible to improve image quality.

Although an example for the case of generating a rectangular block QM bydown-converting a square block QM in a vertical direction has beendescribed herein, the same method as that described in the example shownin FIG. 100 may be used also in the case of generating a rectangularblock QM by down-converting a square block QM in a horizontal direction.

[Second Example of Method of Generating Rectangular Block QM in FirstExample]

FIG. 101 is a diagram for explaining a second example of generating arectangular block QM from a square block QM in step S102 in FIG. 97 orstep S202 in FIG. 98 . The processes described herein are commonlyperformed by encoder 100 and decoder 200.

In FIG. 101 , a square block having a size of from 2×2 to 256×256 isassociated with the sizes of a rectangular block QM to be generated froma square block QM having one of the aforementioned sizes. The exampleshown in FIG. 101 is characterized in that the length of the shorterside of each of rectangular blocks equals to the length of the side ofthe corresponding square block. Stated differently, the size of arectangular block which is a current block is larger than the size of asquare block. In other words, encoder 100 or decoder 200 according tothe first aspect of the present disclosure generates a rectangular blockQM by up-converting a square block QM having a side whose length isequal to the length of the shorter side of a rectangular block which isa current block.

FIG. 101 shows a correspondence relationship between a square block QMhaving a different block size and rectangular block QMs to be generatedfrom the corresponding square block QM, without differentiating the caseof referring to a luma block from the case of referring to a chromablock. A correspondence relationship between rectangular block QMs and asquare block QM which are compliant with a format to be actually usedmay be derived where necessary. In the case of using a 4:2:0 format, forexample, when a luma block is referred to in the process of generating arectangular block QM from a square block QM, a rectangular block QMhaving a size such that the shorter side is at least 4 and the longerside is at most 256 is only allowed to be used for a rectangular blockQM to be generated from a square block QM. When a chroma block isreferred to in the process of generating a rectangular block QM from asquare block QM, a rectangular block QM having a size such that theshorter side is at least 2 and the longer side is at most 128 is onlyallowed to be used for a rectangular block QM to be generated from asquare block QM. The case of using a 4:4:4 format is the same as thecase described with reference to FIG. 99 , the description is thereforeomitted.

Thus, it is desirable to derive, where necessary, a correspondencerelationship between a square block QM and rectangular block QMs,according to a format to be actually used.

The block sizes shown in FIG. 101 are mere examples and are not limitedto such. For example, a QM having a block size other than the blocksizes shown in FIG. 101 may be used or only one or more of the blocksizes shown in FIG. 101 may be used

FIG. 102 is a diagram for explaining a method of generating arectangular block QM by up-converting the corresponding square block QM,which is described with reference to FIG. 101 .

In the example shown in FIG. 101 , an 8×4 rectangular block QM isgenerated from a 4×4 square block QM.

In the up-conversion, matrix elements in a rectangular block QM may bedivided into groups that are identical in number to matrix elements in asquare block QM. In each of the groups, matrix elements included in thegroup in the rectangular block QM may be determined, for example, byrepeating the matrix elements included in the group, or the matrixelements in the rectangular block QM may be determined by performinglinear interpolation between neighboring matrix elements among thematrix elements in the rectangular block QM.

For example, in FIG. 102 , matrix elements in an 8×4 rectangular blockQM is enclosed per a determined number by a thick line. The determinednumber of matrix elements enclosed by the thick line constitute onegroup. The determined number of matrix elements may be predetermined. Inthe up-conversion shown in FIG. 102 , the 8×4 rectangular block QM isdivided into groups so that the number of the groups is equal to thenumber of matrix elements (also referred to as quantized coefficients)in the corresponding 4×4 square block QM. In the example shown in FIG.102 , two quantized coefficients neighboring in a left-and-rightdirection constitute one group. Subsequently, by selecting, as each ofthe quantized coefficients constituting the group, a quantizedcoefficient value that is in the square block QM and corresponds to thegroup, and placing the selected value, values in the 8×4 rectangularblock QM are determined.

A method of deriving quantized coefficients in each group in arectangular block QM is not limited to the above example, and adifferent method may be used. For example, quantized coefficient valuesin a neighboring frequency domain may be referred to and linearinterpolation, for instance, may be performed so that quantizedcoefficients in each group have consecutive values. When decimal occursas a result of calculation of these values, a resultant value may berounded up, down, or to the nearest integer.

A method of deriving quantized coefficients in each group in arectangular block QM may be switched from one to another according to afrequency domain in which the group is located in the rectangular blockQM. When a group is located in a low frequency domain, quantizedcoefficients in the group may be derived so that each of the quantizedcoefficients has a value as small as possible, and when a group islocated in a high frequency domain, quantized coefficients in the groupmay be derived so that each of the quantized coefficients has a value aslarge as possible.

The lowest frequency component (the most upper left quantizedcoefficient in the example in FIG. 102 ) in a rectangular block QM to begenerated may be written into a stream and thus directly set in thestream, instead of being derived from a square block QM. In such a case,an increase in the amount of information to be written into the streammight increase a load for encoding a header area, but allows a directcontrol of the quantized coefficient of the lowest frequency componentthat has the greatest influence on the image quality of pictures, and itis therefore highly possible to improve the image quality.

Although an example for the case of generating a rectangular block QM byup-converting a square block QM in a vertical direction has beendescribed herein, the same method as that described in the example shownin FIG. 102 may be used also in the case of generating a rectangularblock QM by up-converting a square block QM in a horizontal direction.

[Other Variations of First Example of Encoding Process or DecodingProcess Using Quantization Matrices]

The methods of generating a rectangular block QM from a square block QM,one described in the first example with reference to FIG. 99 and FIG.100 and the other described in the second example with reference to FIG.101 and FIG. 102 , may be switched therebetween for use. For example, anaspect ratio of a rectangular block (a magnification with which arectangular block is down-converted or up-converted) is compared with athreshold. When the magnification is greater than the threshold, themethod described in the first example is used, and when themagnification is smaller than the threshold, the method described in thesecond example is used. Alternatively, another method is to write, intoa stream and for each rectangular block size, a flag indicating eitherthe method described in the first example or the method described in thesecond example should be used, and switch between the methods. Thisenables switching between down-conversion and up-conversion according tothe size of a rectangular block, and this in turn makes it possible togenerate a more appropriate rectangular block QM.

Instead of switching between up-conversion and down-conversion accordingto the size of a rectangular block, the up-conversion and thedown-conversion may be combined for use for one rectangular block. Forexample, a 32×32 square block QM may be up-converted in a horizontaldirection to generate a 32×64 rectangular block QM, and the 32×64rectangular block QM may be subsequently down-converted in a verticaldirection to generate a 16×64 rectangular block QM.

Up-conversion may be performed in two directions for one rectangularblock. For example, a 16×16 square block QM may be up-converted in avertical direction to generate a 32×16 rectangular block QM, and the32×16 rectangular block QM may be subsequently up-converted in ahorizontal direction to generate a 32×64 rectangular block QM.

Similarly, down-conversion may be performed in two directions for onerectangular block. For example, a 64×64 square block QM may bedown-converted in a horizontal direction to generate a 64×32 rectangularblock QM, and the 64×32 rectangular block QM may be subsequentlydown-converted in a vertical direction to generate a 16×32 rectangularblock QM.

[Advantageous Effects of First Example of Encoding Process or DecodingProcess Using Quantization Matrices]

Encoder 100 or decoder 200 according to the first aspect of the presentdisclosure, which has the configuration described with reference to FIG.97 or FIG. 98 is capable of encoding or decoding a rectangular blockeven with an encoding method for current blocks including variousrectangular blocks, by writing into a stream not a rectangular block QMhaving a different shape, but only a square block QM. In other words,with encoder 100 or decoder 200 according to the first aspect of thepresent disclosure, it is possible to reduce a load for encoding aheader area since the rectangular block QM is not written into thestream. Moreover, with encoder 100 and decoder 200 according to thefirst aspect of the present disclosure, it is possible to generate arectangular block QM from a square block QM, and this in turn makes itpossible to use an appropriate QM even for a rectangular block withoutincreasing a load for encoding a header area. Accordingly, with encoder100 or decoder 200 according to the first aspect of the presentdisclosure, it is possible to effectively quantize rectangular blockshaving various shapes, and therefore it is highly possible to improvecoding efficiency.

For example, encoder 100 is an encoder that encodes a moving pictureusing quantization and includes circuitry and memory. Using the memory,the circuitry: converts a first quantization matrix for transformcoefficients of a square block to generate, from the first quantizationmatrix, a second quantization matrix for transform coefficients of arectangular block; and quantizes the transform coefficients of therectangular block, using the second quantization matrix.

With this, since a rectangular block quantization matrix is generatedfrom a square block quantization matrix, the rectangular blockquantization matrix need not be encoded. Therefore, an encoding load isreduced, and this improves processing efficiency. Accordingly, withencoder 100, it is possible to effectively quantize a rectangular block.

For example, in encoder 100, the circuitry may encode, into a bitstream,only the first quantization matrix out of the first quantization matrixand the second quantization matrix.

With this, an encoding load is reduced. Therefore, with encoder 100,processing efficiency is improved.

For example, in encoder 100, the circuitry may generate, throughdown-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients of the square blockhaving a side whose length is equal to a length of a longer side of therectangular block which is a current block may.

This enables encoder 100 to efficiently generate a rectangular blockmatrix quantization from a square block quantization matrix having aside whose length is equal to the length of the longer side of arectangular block.

For example, in encoder 100, in the down-conversion, the circuitry maydivide matrix elements in the first quantization matrix into groups thatare identical in number to matrix elements in the second quantizationmatrix. In each of the groups, matrix elements included in the group maybe sequentially arranged in a horizontal direction or a verticaldirection of the square block. For each of the groups, the circuitry maydetermine as a matrix element that is in the second quantization matrixand corresponds to the group (i) a matrix element located at a lowestfrequency domain among the matrix elements included in the group, (ii) amatrix element located at a highest frequency domain among the matrixelements included in the group, or (iii) an average value of the matrixelements included in the group.

This enables encoder 100 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, in encoder 100, the circuitry may generate, throughup-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients of the square blockhaving a side whose length is equal to a length of a shorter side of therectangular block which is a current block.

This enables encoder 100 to efficiently generate a rectangular blockquantization matrix from a square block quantization matrix having aside whose length is equal to the length of the shorter side of arectangular block.

For example, in encoder 100, in the up-conversion, the circuitry may (i)divide matrix elements in the second quantization matrix into groupsthat are identical in number to matrix elements in the firstquantization matrix, and determine, for each of the groups, matrixelements included in the group in the second quantization matrix byrepeating the matrix elements included in the group, or (ii) determinethe matrix elements in the second quantization matrix by performinglinear interpolation between neighboring matrix elements among thematrix elements in the second quantization matrix.

This enables encoder 100 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, in encoder 100, the circuitry may generate the secondquantization matrix by switching, according to a ratio of a shorter sideto a longer side of the rectangular block which is a current block,between (i) a method of generating, through down-conversion, the secondquantization matrix from the first quantization matrix for the transformcoefficients of the square block having a side whose length is equal toa length of the longer side of the rectangular block, and (ii) a methodof generating, through up-conversion, the second quantization matrixfrom the first quantization matrix for the transform coefficients of thesquare block having a side whose length is equal to a length of theshorter side of the rectangular block.

This enables encoder 100 to switch between down-conversion andup-conversion according to the size of a current block, and therebygenerating a more appropriate rectangular block quantization matrix froma square block quantization matrix.

Decoder 200 is a decoder that decodes a moving picture using inversequantization and includes circuitry and memory. Using the memory, thecircuitry: converts a first quantization matrix for transformcoefficients of a square block to generate, from the first quantizationmatrix, a second quantization matrix for transform coefficients of arectangular block; and inverse quantizes the transform coefficients ofthe rectangular block, using the second quantization matrix.

With this, since a rectangular block quantization matrix is generatedfrom a square block quantization matrix, the rectangular blockquantization matrix need not be decoded. Therefore, the amount ofprocessing can be reduced, and this improves processing efficiency.Accordingly, with decoder 200, it is possible to effectively inversequantize a rectangular block.

For example, in decoder 200, the circuitry may decode, from a bitstream,only the first quantization matrix out of the first quantization matrixand the second quantization matrix.

This can reduce the amount of processing. Therefore, with encoder 200,processing efficiency is improved.

For example, in decoder 200, the circuitry may generate, throughdown-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients of the square blockhaving a side whose length is equal to a length of a longer side of therectangular block which is a current block.

This enables decoder 200 to efficiently generate a rectangular blockquantization matrix from a square block quantization matrix having aside whose length is equal to the length of the longer side of arectangular block.

For example, in decoder 200, in the down-conversion, the circuitry maydivide matrix elements in the first quantization matrix into groups thatare identical in number to matrix elements in the second quantizationmatrix. In each of the groups, matrix elements included in the group maybe sequentially arranged in a horizontal direction or a verticaldirection of the square block. For each of the groups, the circuitry maydetermine as a matrix element that is in the second quantization matrixand corresponds to the group (i) a matrix element located at a lowestfrequency domain among the matrix elements included in the group, (ii) amatrix element located at a highest frequency domain among the matrixelements included in the group, or (iii) an average value of the matrixelements included in the group.

This enables decoder 200 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, in decoder 200, the circuitry may generate, throughup-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients of the square blockhaving a side whose length is equal to a length of a shorter side of therectangular block which is a current block.

This enables decoder 200 to efficiently generate a rectangular blockquantization matrix from a square block quantization matrix having aside whose length is equal to the length of the shorter side of arectangular block.

For example, in decoder 200, in the up-conversion, the circuitry may (i)divide matrix elements in the second quantization matrix into groupsthat are identical in number to matrix elements in the firstquantization matrix, and determine, for each of the groups, matrixelements included in the group in the second quantization matrix byrepeating the matrix elements included in the group, or (ii) determinethe matrix elements in the second quantization matrix by performinglinear interpolation between neighboring matrix elements among thematrix elements in the second quantization matrix.

This enables decoder 200 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, in decoder 200, the circuitry may generate the secondquantization matrix by switching, according to a ratio of a shorter sideto a longer side of the rectangular block which is a current block,between (i) a method of generating, through down-conversion, the secondquantization matrix from the first quantization matrix for the transformcoefficients of the square block having a side whose length is equal toa length of the longer side of the rectangular block, and (ii) a methodof generating, through up-conversion, the second quantization matrixfrom the first quantization matrix for the transform coefficients of thesquare block having a side whose length is equal to a length of theshorter side of the rectangular block.

This enables decoder 200 to switch between down-conversion andup-conversion according to the size of a current block, and therebygenerating a more appropriate rectangular block quantization matrix froma square block quantization matrix.

An encoding method according to the first aspect of the presentdisclosure is an encoding method of encoding a moving picture usingquantization. The encoding method includes: converting a firstquantization matrix for transform coefficients of a square block togenerate, from the first quantization matrix, a second quantizationmatrix for transform coefficients of a rectangular block; and quantizingthe transform coefficients of the rectangular block, using the secondquantization matrix.

With this, since a rectangular block quantization matrix is generatedfrom a square block quantization matrix, the rectangular blockquantization matrix need not be encoded. Therefore, an encoding load isreduced, and this improves processing efficiency. Accordingly, with theencoding method as described above, it is possible to effectivelyquantize a rectangular block.

A decoding method according to the first aspect of the presentdisclosure is a decoding method of decoding a moving picture usinginverse quantization. The decoding method includes: converting a firstquantization matrix for transform coefficients of a square block togenerate, from the first quantization matrix, a second quantizationmatrix for transform coefficients of a rectangular block; and inversequantizing the transform coefficients of the rectangular block, usingthe second quantization matrix.

With this, since a rectangular block quantization matrix is generatedfrom a square block quantization matrix, the rectangular blockquantization matrix need not be decoded. Therefore, the amount ofprocessing can be reduced, and this improves processing efficiency.Accordingly, with the decoding method as described above, it is possibleto effectively inverse quantize a rectangular block.

This aspect may be implemented in combination with at least one or moreof the other aspects according to the present disclosure. In addition,one or more of the processes in the flowcharts, one or more of theconstituent elements of the apparatuses, and part of the syntaxdescribed in this aspect may be implemented in combination with otheraspects.

[Second Aspect]

The following describes encoder 100, decoder 200, an encoding method,and a decoding method according to a second aspect of the presentdisclosure.

[Second Example of Encoding Process or Decoding Process UsingQuantization Matrices]

FIG. 103 illustrates a second example of the flow of the encodingprocess using quantization matrices (QMs) performed by encoder 100.Encoder 100 described herein performs the encoding process for each ofsquare and rectangular blocks obtained by partitioning a screen.

First, in step S701, quantizer 108 generates a QM corresponding to thesize of an effective transform coefficient region in each size of asquare block or a rectangular block. Stated differently, quantizer 108quantizes, using a quantization matrix, only transform coefficients in adetermined region in a low frequency domain among transform coefficientsincluded in a current block. The determined region may be predetermined.

Entropy encoder 110 writes, into a stream, a signal related to theeffective transform coefficient region QM generated in step S701. Stateddifferently, entropy encoder 110 encodes, into a bitstream, a signalrelated to a quantization matrix including only matrix elementscorresponding to transform coefficients in a determined range in a lowfrequency domain. The determined range may be predetermined. Quantizer108 may generate an effective transform coefficient region QM fromvalues that are set for encoder 100 by a user or adaptively generate aneffective transform coefficient region QM using coding information of apicture that has already been encoded. The effective transformcoefficient region QM may be encoded into any one of the following areasin the stream: a sequence header area; a picture header area; a sliceheader area; a supplemental information area; or an area for storingother parameters. Note that the effective transform coefficient regionQM need not be written into the stream. In this case, quantizer 108 mayuse, as values in an effective transform coefficient region QM, valuesdefined by default in standards.

The process in step S701 may be performed all at once when sequenceprocessing, picture processing, or slice processing, is started, or oneor more of processes in per-block processing may be performed everytime. In step S701, plural types of QMs may be generated for blocks ofthe same size, according to conditions such as whether a QM is generatedfor a luma block or a chroma block, or for an intra picture predictionblock or an inter picture prediction block, and any other condition.

In the processing flow shown in FIG. 103 , the processes other than stepS701 are performed on a per block basis in loop processing and are thesame as the processes performed in the first example described withreference to FIG. 97 .

This enables encoding a current block having a size, for which only aportion of a region including transform coefficients in a low frequencydomain among transform coefficients included in the current block isdefined as a region including effective transform coefficients, withoutuselessly writing a signal related to a disabled region QM into astream. Accordingly, a load for encoding a header area can be reduced,and it is therefore highly possible to improve coding efficiency.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

FIG. 104 illustrates an example of the flow of the decoding processusing quantization matrices (QMs) performed by decoder 200 correspondingto encoder 100 described with reference to FIG. 103 . Decoder 200described herein performs the decoding process for each of square andrectangular blocks obtained by partitioning a screen.

First, in step S801, entropy decoder 202 decodes, from a stream, asignal related to an effective transform coefficient region QM, andgenerates the effective transform coefficient region QM using thedecoded signal. An effective transform coefficient region QM is a QMcorresponding to the size of an effective transform coefficient regionin each size of a current block. The effective transform coefficientregion QM may be decoded from any one of the following areas in thestream: a sequence header area; a picture header area; a slice headerarea; a supplemental information area; and an area for storing otherparameters. Note that the effective transform coefficient region QM neednot be written into the stream. In this case, values defined by defaultin standards may be used, for example, as an effective transformcoefficient region QM.

The process in step S801 may be performed all at once when sequenceprocessing, picture processing, or slice processing is started, or oneor more of processes in per-block processing may be performed everytime. In step S801, entropy decoder 202 may generate plural types of QMsfor blocks of the same size, according to conditions such as whether aQM is generated for a luma block or a chroma block, or for an intrapicture prediction block or an inter picture prediction block, and anyother condition.

In the processing flow shown in FIG. 104 , the processes other than stepS801 are performed on a per block basis in loop processing and are thesame as the processes in the first example described with reference toFIG. 98 .

This enables, even when a signal related to a disabled region QM is notuselessly written into a stream, decoding a current block having a sizefor which only a portion of a region including transform coefficients ina low frequency domain among transform coefficients included in acurrent block is defined as a region including effective transformcoefficients. Accordingly, a load for encoding a header area can bereduced, and therefore it is highly possible to improve codingefficiency.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

FIG. 105 is a diagram for explaining examples of a QM which correspondsto the size of an effective transform coefficient region in a currentblock having a different size, and is generated in step S701 in FIG. 103or step S801 in FIG. 104 . The processes described herein are commonlyperformed by encoder 100 and decoder 200.

(a) in FIG. 105 illustrates an example for the case where the size of acurrent block is a 64×64 square block. A 32×32 region in a low frequencydomain indicated by diagonal lines in the diagram is a region includingeffective transform coefficients. In the current block, transformcoefficients in a region other than the region including effectivetransform coefficients are forced to 0. In other words, since thetransform coefficients are disabled, it becomes unnecessary to quantizeor inverse quantize these transform coefficients. Namely, encoder 100 ordecoder 200 according to the second aspect of the present disclosuregenerates only a 32×32 QM corresponding to the 32×32 region in the lowfrequency domain indicated by the diagonal lines in the diagram.

Subsequently, (b) in FIG. 105 illustrates an example for the case wherethe size of a current block is a 64×32 rectangular block. In (b) in FIG.105 , encoder 100 or decoder 200 generates only a 32×32 QM correspondingto the 32×32 region in the low frequency domain, as is the caseillustrated in (a) in FIG. 105 .

Subsequently, (c) in FIG. 105 illustrates an example for the case wherethe size of a current block is a 64×16 rectangular block. In (c) in FIG.105 , since the current block has only 16 in a vertical direction,encoder 100 or decoder 200 generates only a 32×16 QM corresponding tothe 32×16 region in the low frequency domain, which is different fromthe example illustrated in (a) in FIG. 105 .

In this way, when either the height or width of a current block isgreater than a threshold, in this example, a threshold of 32, transformcoefficients in a region greater than 32×32 are disabled, and a regionof at most 32×32 is determined as an effective transform coefficientregion and is subjected to quantization or inverse quantization.Accordingly, a QM corresponding to the effective transform coefficientregion is generated and a signal related to the QM is encoded into ordecoded from a stream.

Since this enables encoding or decoding without uselessly writing into astream a signal related to a disabled region QM, it is possible toreduce a load for encoding a header area. Therefore, it is highlypossible to improve coding efficiency.

The sizes of an effective transform coefficient region described withreference to FIG. 105 are mere examples, and a size other than these maybe used. For example, a region up to 32×32 may be defined as aneffective transform coefficient region when a current block is a lumablock whereas a region up to 16×16 may be defined as an effectivetransform coefficient region when a current block is a chroma block.When the longer side of a current block is 64, a region up to 32×32 maybe defined as an effective transform coefficient region, and when thelonger side of a current block is 128 or 256, a region up to 62×62 maybe defined as an effective transform coefficient region.

After once generating quantization matrix coefficients for all offrequency components in a square or rectangular block using the sameprocessing as performed in the method described in the first aspect, aneffective transform coefficient region QM as described with reference toFIG. 105 may be generated. In this case, the amount of signal related toa QM written into a stream is the same as that described in the firstaspect, but it becomes possible to omit the quantization of transformcoefficients in a region other than an effective transform coefficientregion while allowing the generation of all of square and rectangularblock QMs using the method described in the first aspect, as-is. Thismakes it highly possible to reduce the amount of processing related toquantization.

[Variation of Second Example of Encoding Process or Decoding ProcessUsing Quantization Matrices]

FIG. 106 illustrates a variation of the second example of the flow ofthe encoding process using quantization matrices (QMs) performed byencoder 100. Encoder 100 described herein performs the encoding processfor each of square and rectangular blocks obtained by partitioning ascreen.

This variation provides a configuration obtained by combining theconfiguration of the second example described with reference to FIG. 103and the configuration of the first example described with reference toFIG. 97 , and steps S1001 and S1002 are performed instead of step S701in FIG. 103 .

First, quantizer 108 generates a square block QM in step S1001. Thesquare block QM is a QM corresponding to the size of an effectivetransform coefficient region in a square block. Entropy encoder 110writes, into a stream, a signal related to the square block QM generatedin step S1001. The signal related to the QM written into the stream is asignal related only to quantized coefficients corresponding to transformcoefficients in the effective transform coefficient region.

Subsequently, in step S1002, quantizer 108 generates a rectangular blockQM using the square block QM generated in step S1001. Here, entropyencoder 110 does not write, into the stream, a signal related to therectangular block QM.

In the processing flow shown in FIG. 106 , the processes other thansteps S1001 and S1002 are performed on a per block basis in loopprocessing and are the same as the processes in the first exampledescribed with reference to FIG. 97 .

This enables encoding even with an encoding method for current blocksincluding various rectangular blocks, by writing into a stream not asignal related to a rectangular block QM having a different shape, butonly a signal related to a square block QM. Furthermore, this enablesencoding a current block having a size, for which only a regionincluding one or more transform coefficients among transformcoefficients included in the current block is defined as an effectiveregion (effective transform coefficient region), without uselesslywriting into a stream a signal related to a QM for a disabled region.Accordingly, since it becomes possible to use an appropriate QM for arectangular block while reducing a load for encoding a header area, itis highly possible to improve coding efficiency.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

FIG. 107 illustrates an example of the flow of the decoding processusing quantization matrices (QMs) performed by decoder 200 correspondingto encoder 100 described with reference to FIG. 106 . Decoder 200described herein performs the decoding process for each of square andrectangular blocks obtained by partitioning a screen.

This variation provides a configuration obtained by combining theconfiguration of the first example described with reference to FIG. 98and the configuration of the second example described with reference toFIG. 104 , and steps S1101 and S1102 are performed instead of step S801in FIG. 104 .

First, in step S1101, entropy decoder 202 decodes, from a stream, asignal related to a square block QM and generates the square block QMusing the decoded signal. The signal decoded from the stream is a signalrelated only to quantized coefficients corresponding to an effectivetransform coefficient region. Therefore, a square block QM to begenerated by entropy decoder 202 is a QM corresponding to the size ofthe effective transform coefficient region.

Subsequently, in step S1102, entropy decoder 202 generates a rectangularblock QM using the square block QM generated in step S1101. Here,entropy decoder 202 does not decode, from the stream, a signal relatedto the rectangular block QM.

In the processing flow shown in FIG. 107 , the processes other thansteps S1101 and S1102 are performed on a per block basis in loopprocessing and are the same as the processes in the first exampledescribed with reference to FIG. 98 .

This enables decoding even with an encoding method for current blocksincluding various rectangular blocks, provided that only a signalrelated to a square block QM is written into a stream while a signalrelated to a rectangular block QM having a different shape is not.Furthermore, this enables, even when a signal related to a disabledregion QM is not uselessly written into a stream, decoding a currentblock having a size, for which only a region including one or moretransform coefficients among transform coefficients included in thecurrent block is defined as an effective region (i.e., effectivetransform coefficient region). Accordingly, since it becomes possible touse the square block QM even for a rectangular block while reducing aload for encoding a header area, it is highly possible to improve codingefficiency.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

[First Example of Method of Generating Rectangular Block QM in Variationof Second Example]

FIG. 108 is a diagram for explaining a first example of generating arectangular block QM from a square block QM in step S1002 in FIG. 106 orstep S1102 in FIG. 107 . The processes described herein are commonlyperformed by encoder 100 and decoder 200.

In FIG. 108 , a square block having the size of from 2×2 to 256×256 isassociated with the sizes of a rectangular block QM to be generated froma square block QM having one of the aforementioned sizes. The example inFIG. 108 shows the sizes of a current block and the sizes of aneffective transform coefficient region in the current block. The numericvalues written in parentheses each show the size of an effectivetransform coefficient region in a current block. The processes performedfor a rectangular block whose size as a current block is equal to thesize of an effective transform coefficient region in the current block,are the same as those in the first example described with reference toFIG. 99 , a numeric value for the size of such a rectangular block isomitted from the correspondence chart shown in FIG. 108 .

Here, it is characterized in that the length of the longer side of eachof rectangular blocks equals to the length of a side of thecorresponding square block and the rectangular blocks are smaller thanthe corresponding square block. In other words, a rectangular block QMis generated by down-converting a square block QM.

FIG. 108 shows a correspondence relationship between a square block QMhaving a different block size and rectangular block QMs to be generatedfrom the corresponding square block QM, without differentiating the caseof referring to a luma block from the case of referring to a chromablock. A correspondence relationship between rectangular block QMs and asquare block QM which are compliant with a format to be actually usedmay be derived where necessary. In the case of using a 4:2:0 format, forexample, the size of a luma block is twice as large as that of a chromablock. Therefore, when a luma block is referred to in the process ofgenerating a rectangular block QM from a square block QM, the size of ausable square block QM is in the range of from 4×4 to 256×256. In thiscase, a rectangular block QM having a size such that the length of theshorter side is at least 4 and the length of the longer side is at most256 is only allowed to be used for a rectangular block QM to begenerated from a square block QM. When a chroma block is referred to inthe process of generating a rectangular block QM from a square block QM,a rectangular block QM having a size such that the length of the shorterside is at least 2 and the length of the longer side is at most 128 isonly allowed to be used for a rectangular block QM to be generated froma square block QM. The case of using a 4:4:4 format is the same as thecase described with reference to FIG. 99 .

Thus, it is desirable to derive, where necessary, a correspondencerelationship between a square block QM and rectangular block QMs,according to a format to be actually used.

The sizes of an effective transform coefficient region shown in FIG. 108are mere examples, and a size other than these may be used.

The block sizes shown in FIG. 108 are mere examples and are not limitedto such. For example, a block size other than the block sizes shown inFIG. 108 may be used or only one or more of the block sizes shown inFIG. 108 may be used.

FIG. 109 is a diagram for explaining a method of generating arectangular block QM by down-converting the corresponding square blockQM, which is described with reference to FIG. 108 .

In the example shown in FIG. 109 , a 32×32 effective transformcoefficient region QM in a 64×32 rectangular block is generated from a32×32 effective transform coefficient region QM in a 64×64 square block.

First, a 64×64 square block QM having a 32×64 effective region isgenerated in an intermediate step by extending, in a vertical direction,gradients each being derived between vertically neighboring quantizedcoefficients in the 32×32 effective transform coefficient region QM, asshown in (a) in FIG. 109 . The methods of extending each of thegradients include, for example: a method of extending each gradient insuch a way that a difference between vertically neighboring quantizedcoefficients among quantized coefficients following quantizedcoefficients in the 32^(nd) row is equal to a difference between each ofquantized coefficients in the 31^(st) row and the vertically neighboringone of the quantized coefficients in the 32^(nd) row; and a method ofderiving an amount of change between a difference between each ofquantized coefficients in the 30^(th) row and the vertically neighboringone of quantized coefficients in the 31^(st) row and a differencebetween that vertically neighboring quantized coefficient in the 31^(st)row and the vertically neighboring one of quantized coefficients in the32^(nd) row, and extending each gradient while correcting, by the amountof change, a difference between vertically neighboring quantizedcoefficients among quantized coefficients following the quantizedcoefficients in the 32^(nd) row.

Next, a 64×32 rectangular block QM is generated by down-converting,using the same method as that described with reference to FIG. 100 , the64×64 square block QM having the 32×64 effective region, which isgenerated in the intermediate step, as shown in (b) in FIG. 109 . Inthis case, a resultant effective region is a 32×32 region indicated bydiagonal lines in the 64×32 rectangular block QM shown in FIG. 109 .

Although an example for the case of generating a rectangular block QM bydown-converting, in a vertical direction, a square block QM having aneffective region has been described herein, the same method as thatdescribed in the example shown in FIG. 109 may be used also in the caseof generating a rectangular block QM by down-converting, in a horizontaldirection, a square block QM having an effective region.

Although the example of generating a rectangular block QM in two stepsvia an intermediate step of generating a square block QM has beendescribed herein, a rectangular block QM may be generated directly froma square block QM having an effective region, using transformation suchthat the same processing result as that described in the example shownin FIG. 109 is obtained, without going through the intermediate step.

[Second Example of Method of Generating Rectangular Block QM inVariation of Second Example]

FIG. 110 is a diagram for explaining a second example of generating arectangular block QM from a square block QM in step S1002 in FIG. 106 orstep S1102 in FIG. 107 . The processes described herein are commonlyperformed by encoder 100 and decoder 200.

In FIG. 110 , a square block having the size of from 2×2 to 256×256 isassociated with the sizes of a rectangular block QM to be generated froma square block QM having one of the aforementioned sizes. The example inFIG. 110 shows the sizes of a current block and the sizes of aneffective transform coefficient region in a current block. The numericvalues written in parentheses each show the size of an effectivetransform coefficient region in a current block. The processes performedfor a rectangular block whose size as a current block is equal to thesize of an effective transform coefficient region in the current block,are the same as those in the first example described with reference toFIG. 101 , a numeric value for the size of such a rectangular block isomitted from the correspondence chart shown in FIG. 110 .

Here, it is characterized in that the length of the longer side of eachof rectangular blocks equals to the length of a side of thecorresponding square block and the rectangular blocks are larger thanthe corresponding square block. In other words, a rectangular block QMis generated by up-converting a square block QM.

FIG. 110 shows a correspondence relationship between a square block QMhaving a different size and rectangular block QMs to be generated fromthe corresponding square block QM, without differentiating the case ofreferring to a luma block from the case of referring to a chroma block.A correspondence relationship between rectangular block QMs and a squareblock QM which are compliant with a format to be actually used may bederived where necessary. In the case of using a 4:2:0 format, forexample, the size of a luma block is twice as large as that of a chromablock. Therefore, when a luma block is referred to in the process ofgenerating a rectangular block QM from a square block QM, a rectangularblock QM having a size such that the length of the shorter side is atleast 4 and the length of the longer side is at most 256 is only allowedto be used for a rectangular block QM to be generated from a squareblock QM. When a chroma block is referred to in the process ofgenerating a rectangular block QM from a square block QM, a rectangularblock QM having a size such that the length of the shorter side is atleast 2 and the length of the longer side is at most 128 is only allowedto be used for a rectangular block QM to be generated from a squareblock QM. The case of using a 4:4:4 format is the same as the casedescribed with reference to FIG. 99 .

Thus, it is desirable to derive, where necessary, a correspondencerelationship between a square block QM and rectangular block QMs,according to a format to be actually used.

The sizes of an effective transform coefficient region shown in FIG. 110are mere examples, and a size other than these may be used.

The block sizes shown in FIG. 110 are mere examples and are not limitedto such. For example, a block size other than the block sizes shown inFIG. 110 may be used or only one or more of the block sizes shown inFIG. 110 may be used.

FIG. 111 is a diagram for explaining a method of generating arectangular block QM by up-converting the corresponding square block QM,which is described with reference to FIG. 110 .

In the example shown in FIG. 111 , a 32×32 effective transformcoefficient region QM in a 64×32 rectangular block is generated from a32×32 effective transform coefficient region QM in a 32×32 square block.

First, a 64×32 rectangular block QM is generated in an intermediate stepby up-converting a 32×32 square block QM using the same method as thatdescribed with reference to FIG. 102 , as shown in (a) in FIG. 111 .Here, an effective region is also up-converted to 64×32.

Next, a 64×32 rectangular block QM having a 32×32 effective region isgenerated by cutting out only a 32×32 region in a low frequency domainin a 64×32 effective region, as shown in (b) in FIG. 111 .

Although an example for the case of generating a rectangular block QM byup-converting a square block QM in a horizontal direction has beendescribed herein, the same method as that described in the example shownin FIG. 111 may be used also in the case of generating a rectangularblock QM by up-converting a square block QM in a vertical direction.

Although the example of generating a rectangular block QM in two stepsvia an intermediate step of generating a rectangular block QM has beendescribed herein, a rectangular block QM may be generated directly froma square block QM, using transformation such that the same processingresult as that described in the example shown in FIG. 111 is obtained,without going through the intermediate step.

[Other Variations of Second Example of Encoding Process or DecodingProcess Using Quantization Matrices]

The methods of generating a rectangular block QM from a square block QM,one described in the first example with reference to FIG. 108 and FIG.109 and the other described in the second example with reference to FIG.110 and FIG. 111 , may be switched therebetween for use. For example, anaspect ratio of a rectangular block (a magnification with which arectangular block QM is down-converted or up-converted) is compared witha threshold. When the magnification is greater than the threshold, themethod described in the first example is used, and when themagnification is smaller than the threshold, the method described in thesecond example is used. Alternatively, another method is to write, intoa stream and for each rectangular block size, a flag indicating eitherthe method described in the first example or the method described in thesecond example should be used, and switch between the methods. Thisenables switching between down-conversion and up-conversion according tothe size of a rectangular block, and this in turn makes it possible togenerate a more appropriate rectangular block QM.

[Advantageous Effects of Second Example and Variation Thereof ofEncoding Process or Decoding Process Using Quantization Matrices]

Encoder 100 or decoder 200 according to the second aspect of the presentdisclosure, which has the configuration described with reference to FIG.103 or FIG. 104 , is capable of encoding or decoding a current blockhaving a size, for which only a region including one or more transformcoefficients among transform coefficients included in the current blockis defined as an effective region, without uselessly writing into astream a signal related to a disabled region QM. Accordingly, a load forencoding a header area can be reduced, and therefore it is highlypossible to improve coding efficiency.

Furthermore, encoder 100 or decoder 200 according to the second aspectof the present disclosure, which has the configuration described withreference to FIG. 106 or FIG. 107 is capable of encoding or decoding arectangular block even with an encoding method for current blocksincluding various rectangular blocks, by writing into a stream not arectangular block QM having a different shape, but only a square blockQM. In other words, with encoder 100 or decoder 200 according to thesecond aspect of the present disclosure, it is possible to generate arectangular block QM from a square block QM, and this in turn makes itpossible to use an appropriate QM even for a rectangular block whilereducing a load for encoding a header area. Accordingly, with encoder100 or decoder 200 according to the second aspect of the presentdisclosure, it is possible to effectively quantize rectangular blockshaving various shapes, and it is therefore highly possible to improvecoding efficiency.

For example, encoder 100 is an encoder that encodes a moving pictureusing quantization and includes circuitry and memory. Using the memory,the circuitry quantizes, using a quantization matrix, only transformcoefficients in a determined range in a lower frequency domain amongtransform coefficients included in a current block. The determined rangemay be predetermined.

With this, since a current block is quantized using only a quantizationmatrix corresponding to a determined range in a low frequency domain, inthe current block, which has a great influence on human visualperception, the image quality of a moving picture is not easilydegraded. Moreover, since only the quantization matrix corresponding tothe determined range is encoded, an encoding load is reduced.Accordingly, with encoder 100, the image quality of moving pictures isnot easily degraded and processing efficiency is improved.

For example, in encoder 100, the circuitry may encode, into a bitstream,a signal related to the quantization matrix corresponding to thedetermined range in the low frequency domain.

This reduces an encoding load. Therefore, with encoder 100, processingefficiency is improved.

For example, in encoder 100, the current block may be a square block ora rectangular block, the circuitry may (i) convert a first quantizationmatrix for the transform coefficients in the determined range in thesquare block, to generate, from the first quantization matrix, a secondquantization matrix for the transform coefficients in the determinedrange in the rectangular block, as the quantization matrix, and (ii)encode, into a bitstream, only the first quantization matrix out of thefirst quantization matrix and the second quantization matrix, as thesignal related to the quantization matrix.

With this, since encoder 100 generates, for a current block having oneof various shapes including a rectangular shape, a first quantizationmatrix corresponding to a determined range in a low frequency domain ina square block, and encodes only the first quantization matrix, anencoding load is reduced. Moreover, since encoder 100 generates, fromthe first quantization matrix, a second quantization matrixcorresponding to a determined range in a low frequency domain in arectangular block, the image quality of a moving picture is not easilydegraded. Accordingly, with encoder 100, the image quality of movingpictures is not easily degraded and processing efficiency is improved.

For example, in encoder 100, the circuitry may perform down-conversionto generate the second quantization matrix from the first quantizationmatrix for the transform coefficients in the determined range in thesquare block having a side whose length is equal to a length of a longerside of the rectangular block which is the current block.

This enables encoder 100 to efficiently quantize a rectangular block.

For example, according to encoder 100, in the down-conversion, thecircuitry may extrapolate and extend, in a determined direction, matrixelements in the first quantization matrix, divide matrix elements in thefirst quantization matrix into groups that are identical in number tomatrix elements in the second quantization matrix, and for each of thegroups, determine as a matrix element that is in the second quantizationmatrix and corresponds to the group (i) a matrix element located at alowest frequency domain among the matrix elements included in the group,(ii) a matrix element located at a highest frequency domain among thematrix elements included in the group, or (iii) an average value of thematrix elements included in the group. The determined direction may bepredetermined.

This enables encoder 100 to efficiently quantize a rectangular block.

For example, in encoder 100, the circuitry may perform up-conversion togenerate the second quantization matrix from the first quantizationmatrix for the transform coefficients in the determined range in thesquare block having a side whose length is equal to a length of ashorter side of the rectangular block which is the current block.

This enables encoder 100 to efficiently quantize a rectangular block.

For example, according to encoder 100, in the up-conversion, thecircuitry may (i) divide matrix elements in the second quantizationmatrix into groups that are identical in number to matrix elements inthe first quantization matrix, and for each of the groups, extend thefirst quantization matrix in a determined direction by repeating, in thedetermined direction, matrix elements included in the group, andextract, from the first quantization matrix extended, matrix elementsthat are identical in number to the matrix elements in the secondquantization matrix, or (ii) perform linear interpolation between matrixelements neighboring in a determined direction among the matrix elementsin the second quantization matrix, to extend the first quantizationmatrix in the determined direction, and extract, from the firstquantization matrix extended, matrix elements that are identical innumber to the matrix elements in the second quantization matrix. Thedetermined directions may be predetermined.

This enables encoder 100 to more efficiently quantize a rectangularblock.

For example, in encoder 100, the circuitry may generate the secondquantization matrix by switching, according to a ratio of a shorter sideto a longer side of the rectangular block which is the current block,between (i) a method of performing the down-conversion to generate thesecond quantization matrix from the first quantization matrix for thetransform coefficients in the determined range in the square blockhaving a side whose length is equal to a length of the longer side ofthe rectangular block, and (ii) a method of performing the up-conversionto generate the second quantization matrix from the first quantizationmatrix for the transform coefficients in the determined range in thesquare block having a side whose length is equal to a length of theshorter side of the rectangular block.

This enables encoder 100 to generate a more appropriate rectangularblock quantization matrix from a square block quantization matrix, byswitching between down-conversion and up-conversion according to thesize of a current block.

Decoder 200 is a decoder that decodes a moving picture using inversequantization and includes circuitry and memory. Using the memory, thecircuitry inverse quantizes, using a quantization matrix, only quantizedcoefficients in a determined range in a low frequency domain amongquantized coefficients included in a current block. The determined rangemay be predetermined.

With this, since a current block is quantized using only a quantizationmatrix corresponding to a determined range in a low frequency domain, inthe current block, which has a great influence on human visualperception, the image quality of a moving picture is not easilydegraded. Moreover, since only the quantization matrix corresponding tothe determined range is decoded, the amount of processing can bereduced. Accordingly, with decoder 200, the image quality of movingpictures is not easily degraded and processing efficiency is improved.

For example, in decoder 200, the circuitry may decode, from a bitstream,a signal related to the quantization matrix corresponding to thedetermined range in the low frequency domain.

This can reduce the amount of processing. Therefore, with decoder 200,processing efficiency is improved.

For example, in decoder 200, the current block may be a square block ora rectangular block, the circuitry may (i) convert a first quantizationmatrix for the transform coefficients in the determined range in thesquare block, to generate, from the first quantization matrix, a secondquantization matrix for the transform coefficients in the determinedrange in the rectangular block, as the quantization matrix, and (ii)decode, from a bitstream, only the first quantization matrix out of thefirst quantization matrix and the second quantization matrix, as thesignal related to the quantization matrix.

With this, since decoder 200 generates, for a current block having oneof various shapes including a rectangular shape, a first quantizationmatrix corresponding to a determined range in a low frequency domain ina square block, and decodes only the first quantization matrix, theamount of processing can be reduced. Moreover, since decoder 200generates, from the first quantization matrix, a second quantizationmatrix corresponding to a determined range in a low frequency domain ina rectangular block, the image quality of a moving picture is not easilydegraded. Accordingly, with decoder 200, the image quality of movingpictures is not easily degraded and processing efficiency is improved.

For example, in decoder 200, the circuitry may perform down-conversionto generate the second quantization matrix from the first quantizationmatrix for the transform coefficients in the determined range in thesquare block having a side whose length is equal to a length of a longerside of the rectangular block which is the current block.

This enables decoder 200 to efficiently inverse quantize a rectangularblock.

For example, according to decoder 200, in the down-conversion, thecircuitry may extrapolate and extend, in a determined direction, matrixelements in the first quantization matrix, divide the matrix elements inthe first quantization matrix into groups that are identical in numberto matrix elements in the second quantization matrix, and for each ofthe groups, determine as a matrix element that is in the secondquantization matrix and corresponds to the group (i) a matrix elementlocated at a lowest frequency domain among the matrix elements includedin the group, (ii) a matrix element located at a highest frequencydomain among the matrix elements included in the group, or (iii) anaverage value of the matrix elements included in the group.

This enables decoder 200 to efficiently inverse quantize a rectangularblock.

For example, in decoder 200, the circuitry may perform up-conversion togenerate the second quantization matrix from the first quantizationmatrix for the transform coefficients in the determined range in thesquare block having a side whose length is equal to a length of ashorter side of the rectangular block which is the current block.

This enables decoder 200 to efficiently inverse quantize a rectangularblock.

For example, according to decoder 200, in the up-conversion, thecircuitry may (i) divide matrix elements in the second quantizationmatrix into groups that are identical in number to matrix elements inthe first quantization matrix, and for each of the groups, extend thefirst quantization matrix in a determined direction by repeating, in thedetermined direction, matrix elements included in the group, andextract, from the first quantization matrix extended, matrix elementsthat are identical in number to the matrix elements in the secondquantization matrix, or (ii) perform linear interpolation between matrixelements neighboring in a determined direction among the matrix elementsin the second quantization matrix, to extend the first quantizationmatrix in the determined direction and extract, from the firstquantization matrix extended, matrix elements that are identical innumber to the matrix elements in the second quantization matrix.

This enables decoder 200 to more efficiently inverse quantize arectangular block.

For example, in decoder 200, the circuitry may generate the secondquantization matrix by switching, according to a ratio of a shorter sideto a longer side of the rectangular block which is the current block,between (i) a method of performing the down-conversion to generate thesecond quantization matrix from the first quantization matrix for thetransform coefficients in the determined range in the square blockhaving a side whose length is equal to a length of the longer side ofthe rectangular block, and (ii) a method of performing the up-conversionto generate the second quantization matrix from the first quantizationmatrix for the transform coefficients in the determined range in thesquare block having a side whose length is equal to a length of theshorter side of the rectangular block.

This enables decoder 200 to generate a more appropriate rectangularblock quantization matrix from a square block quantization matrix, byswitching between down-conversion and up-conversion according to thesize of a current block.

An encoding method according to the second aspect of the presentdisclosure is an encoding method of encoding a moving picture usingquantization. The encoding method includes quantizing, using aquantization matrix, only transform coefficients in a determined rangein a low frequency domain among transform coefficients included in acurrent block.

With this, since a current block is quantized using only a quantizationmatrix corresponding to a determined range in a low frequency domain, inthe current block, which has a great influence on human visualperception, the image quality of a moving picture is not easilydegraded. Moreover, since only the quantization matrix corresponding tothe determined range is encoded, an encoding load is reduced.Accordingly, with the encoding method as described above, the imagequality of moving pictures is not easily degraded and processingefficiency is improved.

A decoding method according to the second aspect of the presentdisclosure is a decoding method of decoding a moving picture usinginverse quantization. The decoding method includes inverse quantizing,using a quantization matrix, only transform coefficients in a determinedrange in a low frequency domain among transform coefficients included ina current block.

With this, since a current block is quantized using only a quantizationmatrix corresponding to a determined range in a low frequency domain, inthe current block, which has a great influence on human visualperception, the image quality of a moving picture is not easilydegraded. Moreover, since only a quantization matrix corresponding tothe determined range is encoded, an encoding load can be reduced.Accordingly, with the decoding method as described above, the imagequality of moving pictures is not easily degraded and processingefficiency is improved.

This aspect may be implemented in combination with at least one or moreof the other aspects according to the present disclosure. In addition,one or more of the processes in the flowcharts, one or more of theconstituent elements of the apparatuses, and part of the syntaxdescribed in this aspect may be implemented in combination with otheraspects.

The determined ranges and the determined directions may bepredetermined.

[Third Aspect]

The following describes encoder 100, decoder 200, an encoding method,and a decoding method according to a third aspect of the presentdisclosure.

[Third Example of Encoding Process or Decoding Process UsingQuantization Matrices]

FIG. 112 illustrates a third example of the flow of the encoding processusing quantization matrices (QMs) performed by encoder 100. Encoder 100described herein performs the encoding process for each of square andrectangular blocks obtained by partitioning a screen.

First, in step S1601, quantizer 108 generates a QM including onlyquantized coefficients corresponding to the diagonal components of acurrent block (hereinafter also referred to as a diagonal component QM),and generates, from quantized coefficient values in a diagonal componentQM using a common method which will be described below, a current blockQM corresponding to each size of a current block such as a square blockor a rectangular block having a different shape. Stated differently,quantizer 108 generates a quantization matrix for a current block fromthe diagonal components of a quantization matrix including quantizedcoefficients corresponding to transform coefficients sequentially placedalong a diagonal direction of the current block among transformcoefficients included in the current block. The expression “using acommon method” as used herein means using a method commonly used for allof current blocks irrespective of the shape or size of a current block.Diagonal components are, for example, coefficients on a diagonal linefrom a low frequency domain to a high frequency domain in a currentblock.

Entropy encoder 110 writes, into a stream, a signal related to thediagonal component QM generated in step S1601. Stated differently,entropy encoder 110 encodes a signal related to the diagonal componentsof a quantization matrix.

Quantizer 108 may generate quantized coefficient values in a diagonalcomponent QM from values that are set for encoder 100 by a user oradaptively generate the quantized coefficient values using codinginformation of a picture that has already been encoded. The diagonalcomponent QM may be encoded into any one of the following areas in thestream: a sequence header area; a picture header area; a slice headerarea; a supplemental information area; and an area for storing otherparameters. Note that the diagonal component QM may not be written intothe stream. In this case, quantizer 108 may use, as a diagonal componentQM, values defined by default in standards.

The process in step S1601 may be performed all at once when sequenceprocessing, picture processing, or slice processing is started, or oneor more of processes in per-block processing may be performed everytime. In step S1601, plural types of QMs may be generated for blocks ofthe same size, according to conditions such as whether a QM is generatedfor a luma block or a chroma block, or for an intra picture predictionblock or an inter picture prediction block, and any other condition.

In the processing flow shown in FIG. 112 , the processes other than stepS1601 are performed on a per block basis in loop processing and are thesame as the processes in the first example described with reference toFIG. 97 .

This enables encoding a current block by writing, into a stream, not allof quantized coefficients of a QM for the current block having adifferent size, but only quantized coefficients of the QM whichcorrespond to the diagonal components of the current block. Accordingly,it becomes possible, even with an encoding method that uses blockshaving various shapes including a rectangular block, to generate and usea current block QM without greatly increasing a load for encoding aheader area. It is therefore highly possible to improve codingefficiency.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

FIG. 113 illustrates an example of the flow of the decoding processusing quantization matrices (QMs) performed by decoder 200 correspondingto encoder 100 described with reference to FIG. 112 . Decoder 200described herein performs the decoding process for each of square andrectangular blocks obtained by partitioning a screen.

First, in step S1701, entropy decoder 202 decodes, from a stream, asignal related to a diagonal component QM and generates, using thedecoded signal, a QM corresponding to each size of a current blockhaving a different shape, such as a square block or a rectangular block,using a common method which will be described below. The diagonalcomponent QM may be decoded from any one of the following areas in thestream: a sequence header area; a picture header area; a slice headerarea; a supplemental information area; and an area for storing otherparameters. Moreover, the diagonal component QM need not be decoded fromthe stream. In this case, values defined by default in standards may beused as a diagonal component QM.

The process in step S1701 may be performed all at once when sequenceprocessing, picture processing, or slice processing is started, or oneor more of processes in per-block processing may be performed everytime. In step S1701, entropy decoder 202 may generate plural types ofQMs for blocks of the same size, according to conditions such as whethera QM is generated for a luma block or a chroma block, or for an intrapicture prediction block or an inter picture prediction block, and anyother condition.

In the processing flow shown in FIG. 113 , the processes other than stepS1701 are performed on a per block basis in loop processing and are thesame as the processes in the first example described with reference toFIG. 98 .

This enables decoding a current block provided that not all of quantizedcoefficients of a QM corresponding to a size of the current block, butonly quantized coefficients of the QM which correspond to the diagonalcomponents of the current block are written into the stream.Accordingly, a load for encoding a header area can be reduced, and it istherefore highly possible to improve coding efficiency.

The processing flow described above is one example, and the processingorder described herein may be changed, or one or more of the processesdescribed herein may be removed, or a process not described herein maybe added.

FIG. 114 is a diagram for explaining one example of a method ofgenerating, using a common method to be described below, a current blockQM from quantized coefficient values in a QM including only quantizedcoefficients corresponding to the diagonal components of a current blockhaving a different size, which is performed in step S1601 in FIG. 112 orstep S1701 in FIG. 113 . The processes described herein are commonlyperformed by encoder 100 and decoder 200.

Encoder 100 or decoder 200 according to the third aspect generates acurrent block quantization matrix (QM) by repeating, in a horizontaldirection and a vertical direction, each of matrix elementscorresponding to the diagonal components of a current block. Morespecifically, encoder 100 or decoder 200 generates a current block QM byextending, both in upper and left directions, a quantized coefficientvalue of the diagonal component QM, that is, by sequentially placing thesame value in such directions.

Although an example of a method of generating a current block QM in thecase where a current block is a square block is described herein, acurrent block QM may be generated from quantized coefficient values in adiagonal component QM, as in the example described with reference toFIG. 114 , also in the case where a current block is a rectangularblock.

FIG. 115 is a diagram for explaining another example of a method ofgenerating, using a common method to be described below, a current blockQM, from quantized coefficient values in a QM including only quantizedcoefficients corresponding to the diagonal components of a current blockhaving a different size, which is performed in step S1601 in FIG. 112 orstep S1701 in FIG. 113 . The processes described herein are commonlyperformed by encoder 100 and decoder 200.

Encoder 100 or decoder 200 according to the third aspect may generate acurrent block quantization matrix by repeating, in a diagonal direction,each of matrix elements corresponding to the diagonal components of thecurrent block. More specifically, encoder 100 or decoder 200 generates acurrent block QM by extending, both in a lower left and upper rightdirections, a quantized coefficient value in a diagonal component QM,that is, by sequentially placing that same value in such directions.

In this case, encoder 100 or decoder 200 may generate a current block QMby repeating each quantized coefficient in a diagonal direction, usingquantized coefficients of components neighboring diagonal components inaddition to quantized coefficients of the diagonal components. Stateddifferently, a current block quantization matrix (QM) may be generatedfrom matrix elements of diagonal components and matrix elements locatedin the vicinity of the diagonal components. This makes it possible tofill all the quantized coefficients in a current block with the use ofquantized coefficients of neighboring components even when it isdifficult to fill all the quantized coefficients by using only diagonalcomponents. Components neighboring diagonal components include, forexample, a component neighboring any one of coefficients on a diagonalline from a low frequency domain to a high frequency domain in a currentblock.

The quantized coefficients of components neighboring diagonal componentsare, for example, quantized coefficients located in the positions shownin FIG. 115 . Encoder 100 or decoder 200 may set quantized coefficientsof components neighboring diagonal components by encoding into ordecoding from a stream a signal related to the quantized coefficients,or by deriving the quantized coefficients by interpolating between thevalues of neighboring quantized coefficients among the quantizedcoefficients of diagonal components, using, for instance, linearinterpolation, instead of encoding or decoding the signal into or fromthe stream.

Although an example of a method of generating a current block QM in thecase where a current block is a square block is described herein, acurrent block QM may be generated from quantized coefficient values in adiagonal component QM, as in the example described with reference toFIG. 115 , also in the case where a current block is a rectangularblock.

[Other Variations of Third Example of Encoding Process or DecodingProcess Using Quantization Matrices]

In the example described with reference to FIG. 114 or FIG. 115 , amethod of generating quantized coefficients of an entire current blockQM from the quantized coefficients of a diagonal component QM isdescribed, but only one or more of the quantized coefficients of acurrent block QM may be generated from the quantized coefficients of adiagonal component QM. For example, for a QM including quantizedcoefficients corresponding to transform coefficients in a low frequencydomain in a current block, all of the quantized coefficients included inthe QM may be encoded into or decoded from a stream, and only quantizedcoefficients of a QM which correspond to transform coefficients inintermediate and high frequency domains in the current block may begenerated from quantized coefficients of a QM including quantizedcoefficients corresponding to the diagonal components of the currentblock.

A method of generating a rectangular block QM from a square block QM maybe a combination of the third example described with reference to FIG.112 and FIG. 113 and the first example described with reference to FIG.97 and FIG. 98 . For example, a square block QM may be generated fromquantized coefficient values in a diagonal component QM of a squareblock using either of the two common methods described above, asdescribed in the third example, whereas a rectangular block QM may begenerated using the square block QM generated as described in the firstexample.

A method of generating a rectangular block QM from a square block QM maybe a combination of the third example described with reference to FIG.112 and FIG. 113 and the second example described with reference to FIG.103 and FIG. 104 . For example, a QM corresponding to the size of aneffective transform coefficient region in a current block having adifferent size may be generated from quantized coefficient values in adiagonal component QM of the effective transform coefficient region,using either of the above-described common methods.

[Advantageous Effects of Third Example of Encoding Process or DecodingProcess Using Quantization Matrices]

Encoder 100 or decoder 200 according to the third aspect of the presentdisclosure, which has the configuration described with reference to FIG.112 or FIG. 113 , enables encoding or decoding a current block providedthat not all of quantized coefficients of a QM having a different sizeof the current block, but only quantized coefficients of the QM whichcorrespond to the diagonal components of the current block are writteninto the stream. Accordingly, a load for encoding a header area can bereduced, and it is therefore highly possible to improve codingefficiency.

For example, encoder 100 is an encoder that encodes a moving pictureusing quantization and includes circuitry and memory. Using the memory,the circuitry (i) generates a quantization matrix for a current blockfrom diagonal components of the quantization matrix including matrixelements corresponding to transform coefficients sequentially placedalong a diagonal direction of the current block among transformcoefficients included in the current block, and (ii) encodes, into abitstream, a signal related to the diagonal components.

With this, since only the diagonal components of a current block areencoded even in an encoding method that uses blocks having variousshapes including a rectangular block, an encoding load is reduced.Therefore, with encoder 100, processing efficiency is improved.

For example, in encoder 100, the circuitry may generate the quantizationmatrix by repeating, in a horizontal direction and in a verticaldirection, each of matrix elements of the diagonal components.

With this, since quantized coefficients included in a current block aregenerated from quantized coefficients corresponding to the diagonalcomponents of the current block, a quantization matrix of the entirecurrent block need not be encoded. Therefore, an encoding load isreduced, and this improves processing efficiency. Accordingly, withencoder 100, it is possible to effectively quantize a current block.

For example, in encoder 100, the circuitry may generate the quantizationmatrix by repeating, in a diagonal direction, each of the matrixelements of the diagonal components.

With this, since quantized coefficients included in a current block aregenerated from quantized coefficients corresponding to the diagonalcomponents of the current block, the quantization matrix of the entirecurrent block need not be encoded. Therefore, an encoding load isreduced, and this improves processing efficiency. Accordingly, withencoder 100, it is possible to effectively quantize a current block.

For example, in encoder 100, the circuitry may generate the quantizationmatrix from the matrix elements of the diagonal components and matrixelements located in a vicinity of the diagonal components.

With this, since encoder 100 generates quantized coefficients for acurrent block from quantized coefficients corresponding to diagonalcomponents of the current block and quantized coefficients correspondingto components neighboring the diagonal components, it becomes possibleto generate a more appropriate quantization matrix for the currentblock.

For example, in encoder 100, the circuitry may generate the quantizationmatrix by interpolating neighboring matrix elements among the matrixelements of the diagonal components, without encoding, into a bitstream,a signal related to the matrix elements located in the vicinity of thediagonal components.

With this, since an encoding load is reduced, processing efficiency isimproved. Accordingly, with encoder 100, it is possible to effectivelyquantize a current block.

For example, in encoder 100, the circuitry may (i) quantize transformcoefficients in a determined range in a low frequency domain amongtransform coefficients included in the current block, using aquantization matrix, (ii) encode, into a bitstream, a signal related tothe quantization matrix including only matrix elements corresponding tothe transform coefficients in the determined range, and (iii) quantizetransform coefficients in a range other than the determined range, usingthe matrix elements of the diagonal components.

With this, since all of quantized coefficients in a determined range ina low frequency domain, in a current block, which has a great influenceon human visual perception, are encoded, the image quality of a movingpicture is not easily degraded. Moreover, since transform coefficientsin a range other than the determined range are quantized using aquantization matrix including quantized coefficients corresponding tothe diagonal components of the current block, an encoding load isreduced and processing efficiency is improved. Accordingly, with encoder100, the image quality of moving pictures is not easily degraded andprocessing efficiency is improved. The determined range may bepredetermined.

For example, in encoder 100, the quantization matrix may be aquantization matrix corresponding to the determined range in the lowfrequency domain among transform coefficients included in the currentblock.

With this, since encoder 100 generates a quantization matrixcorresponding to a determined range in a low frequency domain, in acurrent block, which has a great influence on human visual perception,the image quality of a moving picture is not easily degraded.

For example, in encoder 100, the current block may be a square block ora rectangular block, and the circuitry may (i) convert a firstquantization matrix for transform coefficients in the determined rangein the square block to generate, from the first quantization matrix, asecond quantization matrix for transform coefficients in the determinedrange in the rectangular block, as the quantization matrix, and (ii)encode, into a bitstream, only the first quantization matrix out of thefirst quantization matrix and the second quantization matrix, as asignal related to the quantization matrix.

With this, since only a first quantization matrix corresponding to adetermined range in a square block is encoded, an encoding load isreduced. Moreover, a second quantization matrix corresponding to adetermined range in a rectangular block is generated from the firstquantization matrix, the image quality of a moving picture is not easilydegraded. A determined range is located in a low frequency domain thatgives a great influence on human visual perception. Therefore, withencoder 100, the image quality of moving pictures is not easily degradedand processing efficiency is improved.

For example, in encoder 100, the circuitry may generate, throughdown-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients in the determinedrange in the square block having a side whose length is equal to alength of a longer side of the rectangular block which is the currentblock.

This enables encoder 100 to efficiently generate a second quantizationmatrix corresponding to a determined range in a rectangular block.

For example, in encoder 100, the circuitry may generate, throughup-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients in the determinedrange in the square block having a side whose length is equal to alength of a shorter side of the rectangular block which is the currentblock.

This enables encoder 100 to efficiently generate a second quantizationmatrix corresponding to a determined range in a rectangular block.

For example, in encoder 100, the circuitry may generate the secondquantization matrix by switching, according to a ratio of a shorter sideto a longer side of the rectangular block which is the current block,between (i) a method of generating, through the down-conversion, thesecond quantization matrix from the first quantization matrix for thetransform coefficients in the determined range in the square blockhaving a side whose length is equal to a length of the longer side ofthe rectangular block, and (ii) a method of generating, through theup-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients in the determinedrange in the square block having a side whose length is equal to alength of the shorter side of the rectangular block.

This enables encoder 100 to generate a more appropriate secondquantization matrix corresponding to a determined range in a rectangularblock from a first quantization matrix corresponding to a determinedrange in a square block, by switching between down-conversion andup-conversion.

For example, decoder 200 is a decoder that decodes a moving pictureusing inverse quantization and includes circuitry and memory. Using thememory, the circuitry (i) generates a quantization matrix for a currentblock from diagonal components of the quantization matrix whichcorrespond to quantized coefficients sequentially placed along adiagonal direction of the current block among quantized coefficientsincluded in the current block, (ii) and decodes, from a bitstream, asignal related to the diagonal components.

With this, since only the diagonal components of a current block aredecoded even in a decoding method that uses blocks having various shapesincluding a rectangular block, the amount of processing can be reduced.Therefore, with decoder 200, processing efficiency is improved.

For example, in decoder 200, the circuitry may generate the quantizationmatrix by repeating, in a horizontal direction and a vertical direction,each of matrix elements of the diagonal components.

With this, since quantized coefficients included in a current block aregenerated from quantized coefficients corresponding to the diagonalcomponents of the current block, a quantization matrix of the entirecurrent block need not be decoded. Therefore, the amount of processingcan be reduced, and this improves processing efficiency. Accordingly,with decoder 200, it is possible to effectively inverse quantize acurrent block.

For example, in decoder 200, the circuitry may generate the quantizationmatrix by repeating, in a diagonal direction, each of the matrixelements of the diagonal components.

With this, since quantized coefficients included in a current block aregenerated from quantized coefficients corresponding to the diagonalcomponents of the current block, a quantization matrix of the entirecurrent block need not be decoded. Therefore, the amount of processingcan be reduced, and this improves processing efficiency. Accordingly,with decoder 200, it is possible to effectively inverse quantize acurrent block.

For example, in decoder 200, the circuitry may generate the quantizationmatrix from the matrix elements of the diagonal components and matrixelements located in a vicinity of the diagonal components.

With this, since decoder 200 generates quantized coefficients includedin a current block from quantized coefficients corresponding to thediagonal components of the current block and quantized coefficientscorresponding to components neighboring the diagonal components, itbecomes possible to generate a more appropriate quantization matrix forthe current block.

For example, in decoder 200, the circuitry may generate the quantizationmatrix by interpolating neighboring matrix elements among the matrixelements of the diagonal components, without decoding, from a bitstream,a signal related to the matrix elements located in the vicinity of thediagonal components.

With this, since the amount of processing can be reduced, processingefficiency is improved. Accordingly, with decoder 200, it is possible toeffectively inverse quantize a current block.

For example, in decoder 200, the circuitry may (i) inverse quantizequantized coefficients in a determined range in a low frequency domainamong quantized coefficients included in the current block, using aquantization matrix, (ii) decode, from a bitstream, a signal related tothe quantization matrix including only matrix elements corresponding tothe transform coefficients in the determined range, and (iii) inversequantize quantized coefficients in a range other than the determinedrange, using the matrix elements of the diagonal components. Thedetermined range may be predetermined.

With this, since all of quantized coefficients in a determined range ina low frequency domain, in a current block, which has a great influenceon human visual perception, are decoded, the image quality of a movingpicture is not easily degraded. Moreover, since quantized coefficientsin a range other than the determined range are inverse quantized using aquantization matrix including quantized coefficients corresponding tothe diagonal components of the current block, the amount of processingcan reduced and processing efficiency is improved. Accordingly, withdecoder 200, the image quality of moving pictures is not easily degradedand processing efficiency is improved.

For example, in decoder 200, the quantization matrix may be aquantization matrix including only matrix elements corresponding totransform coefficients in the determined range in the low frequencydomain among transform coefficients included in the current block.

With this, since decoder 200 generates a quantization matrixcorresponding to a determined range in a low frequency domain, in acurrent block, which has a great influence on human visual perception,the image quality of a moving picture is not easily degraded.

For example, in decoder 200, the current block may be a square block ora rectangular block, and the circuitry may (i) convert a firstquantization matrix for transform coefficients in the determined rangein the square block to generate, from the first quantization matrix, asecond quantization matrix for transform coefficients in the determinedrange in the rectangular block, as the quantization matrix, and (ii)decode, from a bitstream, only the first quantization matrix out of thefirst quantization matrix and the second quantization matrix, as asignal related to the quantization matrix.

With this, since only a first quantization matrix corresponding to adetermined range in a square block is decoded, the amount of processingcan be reduced. Moreover, a second quantization matrix corresponding toa determined range in a rectangular block is generated from the firstquantization matrix, the image quality of a moving picture is not easilydegraded. A determined range is located in a low frequency domain thatgives a great influence on human visual perception. Therefore, withdecoder 200, the image quality of moving pictures is not easily degradedand processing efficiency is improved.

For example, in decoder 200, the circuitry may generate, throughdown-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients in the determinedrange in the square block having a side whose length is equal to alength of a longer side of the rectangular block which is the currentblock.

This enables decoder 200 to efficiently generate a second quantizationmatrix corresponding to a determined range in a rectangular block.

For example, in decoder 200, the circuitry may generate, throughup-conversion, the second quantization matrix from the firstquantization matrix corresponding to the determined range in the squareblock having a side whose length is equal to a length of a shorter sideof the rectangular block which is the current block.

This enables decoder 200 to efficiently generate a second quantizationmatrix corresponding to a determined range in a rectangular block.

For example, in decoder 200, the circuitry may generate the secondquantization matrix by switching, according to a ratio of a shorter sideto a longer side of the rectangular block which is the current block,between (i) a method of generating, through the down-conversion, thesecond quantization matrix from the first quantization matrix for thetransform coefficients in the determined range in the square blockhaving a side whose length is equal to a length of the longer side ofthe rectangular block, and (ii) a method of generating, through theup-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients in the determinedrange in the square block having a side whose length is equal to alength of the shorter side of the rectangular block.

This enables decoder 200 to generate a more appropriate secondquantization matrix corresponding to a determined range in a rectangularblock from a first quantization matrix corresponding to a determinedrange in a square block, by switching between down-conversion andup-conversion.

For example, an encoding method according to the third aspect of thepresent disclosure is an encoding method of encoding a moving pictureusing quantization. The encoding method includes (i) generating aquantization matrix for a current block from diagonal components of thequantization matrix including matrix elements corresponding to transformcoefficients sequentially placed along a diagonal direction of thecurrent block among transform coefficients included in the currentblock, and (ii) encoding, into a bitstream, a signal related to thediagonal components.

With this, since only the diagonal components of a current block areencoded even in an encoding method that uses blocks having variousshapes including a rectangular block, an encoding load is reduced.Therefore, with the encoding method as described above, processingefficiency is improved.

For example, a decoding method according to the third aspect of thepresent disclosure is a decoding method of decoding a moving pictureusing inverse quantization. The decoding method includes (i) generatinga quantization matrix for a current block from diagonal components ofthe quantization matrix including matrix elements corresponding toquantized coefficients sequentially placed along a diagonal direction ofthe current block among quantized coefficients included in the currentblock, and (ii) decoding, from a bitstream, a signal related to thediagonal components.

With this, since only the diagonal components of a current block aredecoded even in a decoding method that uses blocks having various shapesincluding a rectangular block, the amount of processing is reduced.Therefore, with the decoding method as described above, processingefficiency is improved.

This aspect may be implemented in combination with one or more of theother aspects according to the present disclosure. In addition, part ofthe processes in the flowcharts, part of the constituent elements of theapparatuses, and part of the syntax described in this aspect may beimplemented in combination with other aspects.

[Example of Implementation]

FIG. 116 is a block diagram illustrating an example of implementation ofencoder 100. Encoder 100 includes circuitry 160 and memory 162. Forexample, the elements of encoder 100 illustrated in FIG. 7 areimplemented by circuitry 160 and memory 162 illustrated in FIG. 116 .

Circuitry 160 is an electronic circuit accessible to memory 162 andprocesses information. For example, circuitry 160 is a dedicated orgeneral-purpose electronic circuit which encodes videos using memory162. Circuitry 160 may be a processor such as a central processing unit(CPU). Circuitry 160 may be an aggregate of a plurality of electroniccircuits.

For example, circuitry 160 may serve as at least two of the elements ofencoder 100 illustrated in FIG. 7 other than the elements for storinginformation. Namely, circuitry 160 may perform the above-describedoperations as the operations of these elements.

Memory 162 is a dedicated or general-purpose memory that storesinformation for circuitry 160 to encode videos. Memory 162 may be anelectronic circuit and connected to circuitry 160 or included incircuitry 160.

Memory 162 may be an aggregate of a plurality of electronic circuits ormay include a plurality of sub memories. Memory 162 may be a magneticdisk or an optical disc, and may be expressed as storage or recordingmedium. Memory 162 may be nonvolatile memory or volatile memory.

For example, memory 162 may serve as elements for storing information,among the elements of encoder 100 illustrated in FIG. 1 . Specifically,memory 162 may serve as block memory 118 and frame memory 122illustrated in FIG. 7 .

Memory 162 may store an encoded video or a bit string corresponding tothe encoded video. Memory 162 may also store a program for circuitry 160to encode a video. Memory 162 may also store, for instance, informationindicating a pixel value of each sample.

Note that encoder 100 may not include all the elements illustrated inFIG. 7 , and may not perform all the processes described above. One ormore of the elements illustrated in FIG. 7 may be included in anotherdevice, or one or more of the processes described above may be performedby another device. One or more of the elements illustrated in FIG. 7 areimplemented by encoder 100, and with one or more of the above-describedprocesses being carried out, a set of prediction samples isappropriately derived.

FIG. 117 is a flowchart illustrating an example of an operationperformed by encoder 100 illustrated in FIG. 116 . For example, encoder100 illustrated in FIG. 116 performs the operation illustrated in FIG.117 when encoding a moving picture. Specifically, circuitry 160 performsthe following operation using memory 162.

First, circuitry 160 converts a first quantization matrix for transformcoefficients of a square block to generate, from the first quantizationmatrix, a second quantization matrix for transform coefficients of arectangular block (step S401). Subsequently, circuitry 160 quantizes thetransform coefficients of the rectangular block, using the secondquantization matrix (step S402).

With this, since a rectangular block quantization matrix is generatedfrom a square block quantization matrix, the rectangular blockquantization matrix need not be encoded. Therefore, an encoding load isreduced, and this improves processing efficiency. Accordingly, withencoder 100, it is possible to effectively quantize a rectangular block.

For example, circuitry 160 may encode, into a bitstream, only the firstquantization matrix out of the first quantization matrix and the secondquantization matrix.

With this, an encoding load is reduced. Therefore, with encoder 100,processing efficiency is improved.

For example, circuitry 160 may generate, through down-conversion, thesecond quantization matrix from the first quantization matrix for thetransform coefficients of the square block having a side whose length isequal to a length of a longer side of the rectangular block which is acurrent block.

This enables encoder 100 to efficiently generate a rectangular blockquantization matrix from a quantization matrix for a square block havinga side whose length is equal to the length of the longer side of arectangular block.

For example, in the down-conversion, circuitry 160 may divide matrixelements in the first quantization matrix into groups that are identicalin number to matrix elements in the second quantization matrix. In eachof the groups, matrix elements included in the group may be sequentiallyarranged in a horizontal direction or a vertical direction of the squareblock. For each of the groups, circuitry 160 may determine as a matrixelement that is in the second quantization matrix and corresponds to thegroup (i) a matrix element located at a lowest frequency domain amongthe matrix elements included in the group, (ii) a matrix element locatedat a highest frequency domain among the matrix elements included in thegroup, or (iii) an average value of the matrix elements included in thegroup.

This enables encoder 100 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, circuitry 160 may generate, through up-conversion, thesecond quantization matrix from the first quantization matrix for thetransform coefficients of the square block having a side whose length isequal to a length of a shorter side of the rectangular block which is acurrent block.

This enables encoder 100 to efficiently generate a rectangular blockquantization matrix from a quantization matrix for a square block havinga side whose length is equal to the length of the shorter side of arectangular block.

For example, in the up-conversion, circuitry 160 may (i) divide matrixelements in the second quantization matrix into groups that areidentical in number to matrix elements in the first quantization matrix,and determine, for each of the groups, matrix elements included in thegroup in the second quantization matrix by repeating the matrix elementsincluded in the group, or (ii) determine the matrix elements in thesecond quantization matrix by performing linear interpolation betweenneighboring matrix elements among the matrix elements in the secondquantization matrix.

This enables encoder 100 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, circuitry 160 may generate the second quantization matrixby switching, according to a ratio of a shorter side to a longer side ofthe rectangular block which is a current block, between (i) a method ofgenerating, through down-conversion, the second quantization matrix fromthe first quantization matrix for the transform coefficients of thesquare block having a side whose length is equal to a length of thelonger side of the rectangular block, and (ii) a method of generating,through up-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients of the square blockhaving a side whose length is equal to a length of the shorter side ofthe rectangular block.

This enables encoder 100 to generate a more appropriate rectangularblock quantization matrix from a square block quantization matrix byswitching between down-conversion and up-conversion according to thesize of a current block.

FIG. 118 is a block diagram illustrating an example of implementation ofdecoder 200. Decoder 200 includes circuitry 260 and memory 262. Forexample, the elements of decoder 200 illustrated in FIG. 67 areimplemented by circuitry 260 and memory 262 illustrated in FIG. 118 .

Circuitry 260 is an electronic circuit accessible to memory 262 andprocesses information. For example, circuitry 260 is a dedicated orgeneral-purpose electronic circuit which decodes videos using memory262. Circuitry 260 may be a processor such as a CPU. Circuitry 260 maybe an aggregate of a plurality of electronic circuits.

For example, circuitry 260 may serve as at least two of the elements ofdecoder 200 illustrated in FIG. 67 , other than the elements for storinginformation. Namely, circuitry 260 may perform the above-describedoperations as the operations of these elements.

Memory 262 is a dedicated or general-purpose memory that storesinformation for circuitry 260 to decode videos. Memory 262 may be anelectronic circuit and connected to circuitry 260 or included incircuitry 260.

Memory 262 may be an aggregate of a plurality of electronic circuits ormay include a plurality of sub memories. Memory 262 may be a magneticdisk or an optical disc, and may be expressed as storage or recordingmedium. Memory 262 may be nonvolatile memory or volatile memory.

For example, memory 262 may serve as elements for storing information,among the elements of decoder 200 illustrated in FIG. 67 . Specifically,memory 262 may serve as block memory 210 and frame memory 214illustrated in FIG. 67 .

For example, memory 262 may store a decoded video or a bit stringcorresponding to an encoded video. Memory 262 may also store a programfor circuitry 260 to decode videos. Memory 262 may also store a programfor circuitry 260 to decode videos.

Note that decoder 200 may not include all the elements illustrated in,for instance, FIG. 10 or may not perform all the processes describedabove. One or more of the elements illustrated in FIG. 67 may beincluded in another device, and one or more of the processes describedabove may be performed by another device. One or more of the elementsillustrated in FIG. 67 are implemented by decoder 200, and with one ormore of the above-described processes being carried out, a set ofprediction samples is appropriately derived.

FIG. 119 is a flowchart illustrating an example of an operationperformed by decoder 200 illustrated in FIG. 118 . For example, decoder200 illustrated in FIG. 118 performs the operation illustrated in FIG.119 when decoding a moving picture. Specifically, circuitry 260 performsthe following operation using memory 262.

First, circuitry 260 converts a first quantization matrix for transformcoefficients of a square block to generate, from the first quantizationmatrix, a second quantization matrix for transform coefficients of arectangular block (step S301). Subsequently, circuitry 260 quantizes thetransform coefficients of the rectangular block, using the secondquantization matrix (step S302).

With this, since a rectangular block quantization matrix is generatedfrom a square block quantization matrix, the rectangular blockquantization matrix need not be decoded. Therefore, the amount ofprocessing can be reduced, and this improves processing efficiency.Accordingly, with encoder 200, it is possible to effectively inversequantize a rectangular block.

For example, circuitry 260 may decode, from a bitstream, only the firstquantization matrix out of the first quantization matrix and the secondquantization matrix.

This can reduce the amount of processing. Therefore, with encoder 200,processing efficiency is improved.

For example, circuitry 260 may generate, through down-conversion, thesecond quantization matrix from the first quantization matrix for thetransform coefficients of the square block having a side whose length isequal to a length of a longer side of the rectangular block which is acurrent block.

This enables decoder 200 to efficiently generate a rectangular blockquantization matrix from a quantization matrix for a square block havinga side whose length is equal to the length of the longer side of arectangular block.

For example, in the down-conversion, circuitry 260 may divide matrixelements in the first quantization matrix into groups that are identicalin number to matrix elements in the second quantization matrix. In eachof the groups, matrix elements included in the group may be sequentiallyarranged in a horizontal direction or a vertical direction of the squareblock. For each of the groups, circuitry 260 may determine as a matrixelement that is in the second quantization matrix and corresponds to thegroup (i) a matrix element located at a lowest frequency domain amongthe matrix elements included in the group, (ii) a matrix element locatedat a highest frequency domain among the matrix elements included in thegroup, or (iii) an average value of the matrix elements included in thegroup.

This enables decoder 200 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, circuitry 260 may generate, through up-conversion, thesecond quantization matrix from the first quantization matrix for thetransform coefficients of the square block having a side whose length isequal to a length of a shorter side of the rectangular block which is acurrent block.

This enables decoder 200 to efficiently generate a rectangular blockquantization matrix from a quantization matrix for a square block havinga side whose length is equal to the length of the shorter side of arectangular block.

For example, in the up-conversion, circuitry 260 may (i) divide matrixelements in the second quantization matrix into groups that areidentical in number to matrix elements in the first quantization matrix,and determine, for each of the groups, matrix elements included in thegroup in the second quantization matrix by repeating the matrix elementsincluded in the group, or (ii) determine the matrix elements in thesecond quantization matrix by performing linear interpolation betweenneighboring matrix elements among the matrix elements in the secondquantization matrix.

This enables decoder 200 to more effectively generate a rectangularblock quantization matrix from a square block quantization matrix.

For example, circuitry 260 may generate the second quantization matrixby switching, according to a ratio of a shorter side to a longer side ofthe rectangular block which is a current block, between (i) a method ofgenerating, through down-conversion, the second quantization matrix fromthe first quantization matrix for the transform coefficients of thesquare block having a side whose length is equal to a length of thelonger side of the rectangular block, and (ii) a method of generating,through up-conversion, the second quantization matrix from the firstquantization matrix for the transform coefficients of the square blockhaving a side whose length is equal to a length of the shorter side ofthe rectangular block.

This enables decoder 200 to generate a more appropriate rectangularblock quantization matrix from a square block quantization matrix byswitching between down-conversion and up-conversion according to thesize of a current block.

The elements may be circuits as described above. These circuits mayconstitute one circuitry as a whole, or may be separate circuits. Eachelement may be implemented by a general-purpose processor or by adedicated processor.

Processing performed by a specific element may be performed by adifferent element. The order of performing processes may be changed orthe processes may be performed in parallel. An encoder/decoder mayinclude encoder 100 and decoder 200.

Ordinal numbers such as first and second used in the description may beeach replaced with a different ordinal number where necessary. A newordinal number may be provided for the elements or any of the existingordinal numbers may be removed.

The above has given a description of aspects of encoder 100 and decoder200 based on the embodiments, yet the aspects of encoder 100 and decoder200 are not limited to the embodiments. The aspects of encoder 100 anddecoder 200 may also encompass various modifications that may beconceived by those skilled in the art to the embodiments, andembodiments achieved by combining elements in different embodiments,without departing from the scope of the present disclosure.

One or more of the aspects disclosed herein may be performed incombination with at least part of the other aspects in the presentdisclosure. In addition, one or more of the aspects disclosed herein maybe performed by combining, with other aspects, part of the processesindicated in any of the flow charts according to the aspects, part ofthe configuration of any of the devices, part of syntaxes, etc. Aspectsdescribed with reference to a constituent element of an encoder may beperformed similarly by a corresponding constituent element of a decoder.

[Implementations and Applications]

As described in each of the above embodiments, each functional oroperational block may typically be realized as an MPU (micro processingunit) and memory, for example. Moreover, processes performed by each ofthe functional blocks may be realized as a program execution unit, suchas a processor which reads and executes software (a program) recorded ona recording medium such as ROM. The software may be distributed. Thesoftware may be recorded on a variety of recording media such assemiconductor memory. Note that each functional block can also berealized as hardware (dedicated circuit). Various combinations ofhardware and software may be employed.

The processing described in each of the embodiments may be realized viaintegrated processing using a single apparatus (system), and,alternatively, may be realized via decentralized processing using aplurality of apparatuses. Moreover, the processor that executes theabove-described program may be a single processor or a plurality ofprocessors. In other words, integrated processing may be performed, and,alternatively, decentralized processing may be performed.

Embodiments of the present disclosure are not limited to the aboveexemplary embodiments; various modifications may be made to theexemplary embodiments, the results of which are also included within thescope of the embodiments of the present disclosure.

Next, application examples of the moving picture encoding method (imageencoding method) and the moving picture decoding method (image decodingmethod) described in each of the above embodiments will be described, aswell as various systems that implement the application examples. Such asystem may be characterized as including an image encoder that employsthe image encoding method, an image decoder that employs the imagedecoding method, or an image encoder-decoder that includes both theimage encoder and the image decoder. Other configurations of such asystem may be modified on a case-by-case basis.

[Usage Examples]

FIG. 120 illustrates an overall configuration of content providingsystem ex100 suitable for implementing a content distribution service.The area in which the communication service is provided is divided intocells of desired sizes, and base stations ex106, ex107, ex108, ex109,and ex110, which are fixed wireless stations in the illustrated example,are located in respective cells.

In content providing system ex100, devices including computer ex111,gaming device ex112, camera ex113, home appliance ex114, and smartphoneex115 are connected to internet ex101 via internet service providerex102 or communications network ex104 and base stations ex106 throughex110. Content providing system ex100 may combine and connect anycombination of the above devices. In various implementations, thedevices may be directly or indirectly connected together via a telephonenetwork or near field communication, rather than via base stations ex106through ex110. Further, streaming server ex103 may be connected todevices including computer ex111, gaming device ex112, camera ex113,home appliance ex114, and smartphone ex115 via, for example, internetex101. Streaming server ex103 may also be connected to, for example, aterminal in a hotspot in airplane ex117 via satellite ex116.

Note that instead of base stations ex106 through ex110, wireless accesspoints or hotspots may be used. Streaming server ex103 may be connectedto communications network ex104 directly instead of via internet ex101or internet service provider ex102, and may be connected to airplaneex117 directly instead of via satellite ex116.

Camera ex113 may be a device capable of capturing still images andvideo, such as a digital camera. Smartphone ex115 may be a smartphonedevice, cellular phone, or personal handy-phone system (PHS) phone thatcan operate under the mobile communications system standards of the 2G,3G, 3.9G, and 4G systems, as well as the next-generation 5G system.

Home appliance ex114 is, for example, a refrigerator or a deviceincluded in a home fuel cell cogeneration system.

In content providing system ex100, a terminal including an image and/orvideo capturing function is capable of, for example, live streaming byconnecting to streaming server ex103 via, for example, base stationex106. When live streaming, a terminal (e.g., computer ex111, gamingdevice ex112, camera ex113, home appliance ex114, smartphone ex115, or aterminal in airplane ex117) may perform the encoding processingdescribed in the above embodiments on still-image or video contentcaptured by a user via the terminal, may multiplex video data obtainedvia the encoding and audio data obtained by encoding audio correspondingto the video, and may transmit the obtained data to streaming serverex103. In other words, the terminal functions as the image encoderaccording to one aspect of the present disclosure.

Streaming server ex103 streams transmitted content data to clients thatrequest the stream. Client examples include computer ex111, gamingdevice ex112, camera ex113, home appliance ex114, smartphone ex115, andterminals inside airplane ex117, which are capable of decoding theabove-described encoded data. Devices that receive the streamed data maydecode and reproduce the received data. In other words, the devices mayeach function as the image decoder, according to one aspect of thepresent disclosure.

[Decentralized Processing]

Streaming server ex103 may be realized as a plurality of servers orcomputers between which tasks such as the processing, recording, andstreaming of data are divided. For example, streaming server ex103 maybe realized as a content delivery network (CDN) that streams content viaa network connecting multiple edge servers located throughout the world.In a CDN, an edge server physically near the client may be dynamicallyassigned to the client. Content is cached and streamed to the edgeserver to reduce load times. In the event of, for example, some type oferror or change in connectivity due, for example, to a spike in traffic,it is possible to stream data stably at high speeds, since it ispossible to avoid affected parts of the network by, for example,dividing the processing between a plurality of edge servers, orswitching the streaming duties to a different edge server and continuingstreaming.

Decentralization is not limited to just the division of processing forstreaming; the encoding of the captured data may be divided between andperformed by the terminals, on the server side, or both. In one example,in typical encoding, the processing is performed in two loops. The firstloop is for detecting how complicated the image is on a frame-by-frameor scene-by-scene basis, or detecting the encoding load. The second loopis for processing that maintains image quality and improves encodingefficiency. For example, it is possible to reduce the processing load ofthe terminals and improve the quality and encoding efficiency of thecontent by having the terminals perform the first loop of the encodingand having the server side that received the content perform the secondloop of the encoding. In such a case, upon receipt of a decodingrequest, it is possible for the encoded data resulting from the firstloop performed by one terminal to be received and reproduced on anotherterminal in approximately real time. This makes it possible to realizesmooth, real-time streaming.

In another example, camera ex113 or the like extracts a feature amount(an amount of features or characteristics) from an image, compressesdata related to the feature amount as metadata, and transmits thecompressed metadata to a server. For example, the server determines thesignificance of an object based on the feature amount, and changes thequantization accuracy accordingly to perform compression suitable forthe meaning (or content significance) of the image. Feature amount datais particularly effective in improving the precision and efficiency ofmotion vector prediction during the second compression pass performed bythe server. Moreover, encoding that has a relatively low processingload, such as variable length coding (VLC), may be handled by theterminal, and encoding that has a relatively high processing load, suchas context-adaptive binary arithmetic coding (CABAC), may be handled bythe server.

In yet another example, there are instances in which a plurality ofvideos of approximately the same scene are captured by a plurality ofterminals in, for example, a stadium, shopping mall, or factory. In sucha case, for example, the encoding may be decentralized by dividingprocessing tasks between the plurality of terminals that captured thevideos and, if necessary, other terminals that did not capture thevideos, and the server, on a per-unit basis. The units may be, forexample, groups of pictures (GOP), pictures, or tiles resulting fromdividing a picture. This makes it possible to reduce load times andachieve streaming that is closer to real time.

Since the videos are of approximately the same scene, management and/orinstructions may be carried out by the server so that the videoscaptured by the terminals can be cross-referenced. Moreover, the servermay receive encoded data from the terminals, change the referencerelationship between items of data, or correct or replace picturesthemselves, and then perform the encoding. This makes it possible togenerate a stream with increased quality and efficiency for theindividual items of data.

Furthermore, the server may stream video data after performingtranscoding to convert the encoding format of the video data. Forexample, the server may convert the encoding format from MPEG to VP(e.g., VP9), may convert H.264 to H.265, etc.

In this way, encoding can be performed by a terminal or one or moreservers. Accordingly, although the device that performs the encoding isreferred to as a “server” or “terminal” in the following description,some or all of the processes performed by the server may be performed bythe terminal, and likewise some or all of the processes performed by theterminal may be performed by the server. This also applies to decodingprocesses.

[3D, Multi-Angle]

There has been an increase in usage of images or videos combined fromimages or videos of different scenes concurrently captured, or of thesame scene captured from different angles, by a plurality of terminalssuch as camera ex113 and/or smartphone ex115. Videos captured by theterminals may be combined based on, for example, the separately obtainedrelative positional relationship between the terminals, or regions in avideo having matching feature points.

In addition to the encoding of two-dimensional moving pictures, theserver may encode a still image based on scene analysis of a movingpicture, for example automatically or at a point in time specified bythe user, and transmit the encoded still image to a reception terminal.Furthermore, when the server can obtain the relative positionalrelationship between the video capturing terminals, in addition totwo-dimensional moving pictures, the server can generatethree-dimensional geometry of a scene based on video of the same scenecaptured from different angles. The server may separately encodethree-dimensional data generated from, for example, a point cloud and,based on a result of recognizing or tracking a person or object usingthree-dimensional data, may select or reconstruct and generate a videoto be transmitted to a reception terminal, from videos captured by aplurality of terminals.

This allows the user to enjoy a scene by freely selecting videoscorresponding to the video capturing terminals, and allows the user toenjoy the content obtained by extracting a video at a selected viewpointfrom three-dimensional data reconstructed from a plurality of images orvideos. Furthermore, as with video, sound may be recorded fromrelatively different angles, and the server may multiplex audio from aspecific angle or space with the corresponding video, and transmit themultiplexed video and audio.

In recent years, content that is a composite of the real world and avirtual world, such as virtual reality (VR) and augmented reality (AR)content, has also become popular. In the case of VR images, the servermay create images from the viewpoints of both the left and right eyes,and perform encoding that tolerates reference between the two viewpointimages, such as multi-view coding (MVC), and, alternatively, may encodethe images as separate streams without referencing. When the images aredecoded as separate streams, the streams may be synchronized whenreproduced, so as to recreate a virtual three-dimensional space inaccordance with the viewpoint of the user.

In the case of AR images, the server may superimpose virtual objectinformation existing in a virtual space onto camera informationrepresenting a real-world space, for example based on athree-dimensional position or movement from the perspective of the user.The decoder may obtain or store virtual object information andthree-dimensional data, generate two-dimensional images based onmovement from the perspective of the user, and then generatesuperimposed data by seamlessly connecting the images. Alternatively,the decoder may transmit, to the server, motion from the perspective ofthe user in addition to a request for virtual object information. Theserver may generate superimposed data based on three-dimensional datastored in the server in accordance with the received motion, and encodeand stream the generated superimposed data to the decoder. Note thatsuperimposed data typically includes, in addition to RGB values, an αvalue indicating transparency, and the server sets the α value forsections other than the object generated from three-dimensional data to,for example, 0, and may perform the encoding while those sections aretransparent. Alternatively, the server may set the background to adetermined RGB value, such as a chroma key, and generate data in whichareas other than the object are set as the background. The determinedRGB value may be predetermined.

Decoding of similarly streamed data may be performed by the client(e.g., the terminals), on the server side, or be divided therebetween.In one example, one terminal may transmit a reception request to aserver, the requested content may be received and decoded by anotherterminal, and a decoded signal may be transmitted to a device having adisplay. It is possible to reproduce high image quality data bydecentralizing processing and appropriately selecting content regardlessof the processing ability of the communications terminal itself. In yetanother example, while a TV, for example, is receiving image data thatis large in size, a region of a picture, such as a tile obtained bydividing the picture, may be decoded and displayed on a personalterminal or terminals of a viewer or viewers of the TV. This makes itpossible for the viewers to share a big-picture view as well as for eachviewer to check his or her assigned area, or inspect a region in furtherdetail up close.

In situations in which a plurality of wireless connections are possibleover near, mid, and far distances, indoors or outdoors, it may bepossible to seamlessly receive content using a streaming system standardsuch as MPEG-DASH. The user may switch between data in real time whilefreely selecting a decoder or display apparatus including the user'sterminal, displays arranged indoors or outdoors, etc. Moreover, using,for example, information on the position of the user, decoding can beperformed while switching which terminal handles decoding and whichterminal handles the displaying of content. This makes it possible tomap and display information, while the user is on the move in route to adestination, on the wall of a nearby building in which a device capableof displaying content is embedded, or on part of the ground. Moreover,it is also possible to switch the bit rate of the received data based onthe accessibility to the encoded data on a network, such as when encodeddata is cached on a server quickly accessible from the receptionterminal, or when encoded data is copied to an edge server in a contentdelivery service.

[Web Page Optimization]

FIG. 121 illustrates an example of a display screen of a web page oncomputer ex111, for example. FIG. 122 illustrates an example of adisplay screen of a web page on smartphone ex115, for example. Asillustrated in FIG. 121 and FIG. 122 , a web page may include aplurality of image links that are links to image content, and theappearance of the web page may differ depending on the device used toview the web page. When a plurality of image links are viewable on thescreen, until the user explicitly selects an image link, or until theimage link is in the approximate center of the screen or the entireimage link fits in the screen, the display apparatus (decoder) maydisplay, as the image links, still images included in the content or Ipictures; may display video such as an animated gif using a plurality ofstill images or I pictures; or may receive only the base layer, anddecode and display the video.

When an image link is selected by the user, the display apparatusperforms decoding while, for example, giving the highest priority to thebase layer. Note that if there is information in the HTML, code of theweb page indicating that the content is scalable, the display apparatusmay decode up to the enhancement layer. Further, in order to facilitatereal-time reproduction, before a selection is made or when the bandwidthis severely limited, the display apparatus can reduce delay between thepoint in time at which the leading picture is decoded and the point intime at which the decoded picture is displayed (that is, the delaybetween the start of the decoding of the content to the displaying ofthe content) by decoding and displaying only forward reference pictures(I picture, P picture, forward reference B picture). Still further, thedisplay apparatus may purposely ignore the reference relationshipbetween pictures, and coarsely decode all B and P pictures as forwardreference pictures, and then perform normal decoding as the number ofpictures received over time increases.

[Autonomous Driving]

When transmitting and receiving still image or video data such as two-or three-dimensional map information for autonomous driving or assisteddriving of an automobile, the reception terminal may receive, inaddition to image data belonging to one or more layers, information on,for example, the weather or road construction as metadata, and associatethe metadata with the image data upon decoding. Note that metadata maybe assigned per layer and, alternatively, may simply be multiplexed withthe image data. In such a case, since the automobile, drone, airplane,etc., containing the reception terminal is mobile, the receptionterminal may seamlessly receive and perform decoding while switchingbetween base stations among base stations ex106 through ex110 bytransmitting information indicating the position of the receptionterminal. Moreover, in accordance with the selection made by the user,the situation of the user, and/or the bandwidth of the connection, thereception terminal may dynamically select to what extent the metadata isreceived, or to what extent the map information, for example, isupdated.

In content providing system ex100, the client may receive, decode, andreproduce, in real time, encoded information transmitted by the user.

[Streaming of Individual Content]

In content providing system ex100, in addition to high image quality,long content distributed by a video distribution entity, unicast ormulticast streaming of low image quality, and short content from anindividual are also possible. Such content from individuals is likely tofurther increase in popularity. The server may first perform editingprocessing on the content before the encoding processing, in order torefine the individual content. This may be achieved using the followingconfiguration, for example.

In real time while capturing video or image content, or after thecontent has been captured and accumulated, the server performsrecognition processing based on the raw data or encoded data, such ascapture error processing, scene search processing, meaning analysis,and/or object detection processing. Then, based on the result of therecognition processing, the server—for example when prompted orautomatically—edits the content, examples of which include: correctionsuch as focus and/or motion blur correction; removing low-priorityscenes such as scenes that are low in brightness compared to otherpictures, or out of focus; object edge adjustment; and color toneadjustment. The server encodes the edited data based on the result ofthe editing. It is known that excessively long videos tend to receivefewer views. Accordingly, in order to keep the content within a specificlength that scales with the length of the original video, the servermay, in addition to the low-priority scenes described above,automatically clip out scenes with low movement, based on an imageprocessing result. Alternatively, the server may generate and encode avideo digest based on a result of an analysis of the meaning of a scene.

There may be instances in which individual content may include contentthat infringes a copyright, moral right, portrait rights, etc. Suchinstance may lead to an unfavorable situation for the creator, such aswhen content is shared beyond the scope intended by the creator.Accordingly, before encoding, the server may, for example, edit imagesso as to blur faces of people in the periphery of the screen or blur theinside of a house, for example. Further, the server may be configured torecognize the faces of people other than a registered person in imagesto be encoded, and when such faces appear in an image, may apply amosaic filter, for example, to the face of the person. Alternatively, aspre- or post-processing for encoding, the user may specify, forcopyright reasons, a region of an image including a person or a regionof the background to be processed. The server may process the specifiedregion by, for example, replacing the region with a different image, orblurring the region. If the region includes a person, the person may betracked in the moving picture, and the person's head region may bereplaced with another image as the person moves.

Since there is a demand for real-time viewing of content produced byindividuals, which tends to be small in data size, the decoder may firstreceive the base layer as the highest priority, and perform decoding andreproduction, although this may differ depending on bandwidth. When thecontent is reproduced two or more times, such as when the decoderreceives the enhancement layer during decoding and reproduction of thebase layer, and loops the reproduction, the decoder may reproduce a highimage quality video including the enhancement layer. If the stream isencoded using such scalable encoding, the video may be low quality whenin an unselected state or at the start of the video, but it can offer anexperience in which the image quality of the stream progressivelyincreases in an intelligent manner. This is not limited to just scalableencoding; the same experience can be offered by configuring a singlestream from a low quality stream reproduced for the first time and asecond stream encoded using the first stream as a reference.

[Other Implementation and Application Examples]

The encoding and decoding may be performed by LSI (large scaleintegration circuitry) ex500 (see FIG. 120 ), which is typicallyincluded in each terminal. LSI ex500 may be configured from a singlechip or a plurality of chips. Software for encoding and decoding movingpictures may be integrated into some type of a recording medium (such asa CD-ROM, a flexible disk, or a hard disk) that is readable by, forexample, computer ex111, and the encoding and decoding may be performedusing the software. Furthermore, when smartphone ex115 is equipped witha camera, the video data obtained by the camera may be transmitted. Inthis case, the video data may be coded by LSI ex500 included insmartphone ex115.

Note that LSI ex500 may be configured to download and activate anapplication. In such a case, the terminal first determines whether it iscompatible with the scheme used to encode the content, or whether it iscapable of executing a specific service. When the terminal is notcompatible with the encoding scheme of the content, or when the terminalis not capable of executing a specific service, the terminal may firstdownload a codec or application software and then obtain and reproducethe content.

Aside from the example of content providing system ex100 that usesinternet ex101, at least the moving picture encoder (image encoder) orthe moving picture decoder (image decoder) described in the aboveembodiments may be implemented in a digital broadcasting system. Thesame encoding processing and decoding processing may be applied totransmit and receive broadcast radio waves superimposed with multiplexedaudio and video data using, for example, a satellite, even though thisis geared toward multicast, whereas unicast is easier with contentproviding system ex100.

[Hardware Configuration]

FIG. 123 illustrates further details of an example smartphone ex115shown in FIG. 120 . FIG. 124 illustrates a functional configurationexample of a smartphone ex115. Smartphone ex115 includes antenna ex450for transmitting and receiving radio waves to and from base stationex110, camera ex465 capable of capturing video and still images, anddisplay ex458 that displays decoded data, such as video captured bycamera ex465 and video received by antenna ex450. Smartphone ex115further includes user interface ex466 such as a touch panel; audiooutput unit ex457 such as a speaker for outputting speech or otheraudio; audio input unit ex456 such as a microphone for audio input;memory ex467 capable of storing decoded data such as captured video orstill images, recorded audio, received video or still images, and mail,as well as decoded data; and slot ex464 which is an interface for SIMex468 for authorizing access to a network and various data. Note thatexternal memory may be used instead of or in addition to memory ex467.

Main controller ex460, which may comprehensively control display ex458and user interface ex466, power supply circuit ex461, user interfaceinput controller ex462, video signal processor ex455, camera interfaceex463, display controller ex459, modulator/demodulator ex452,multiplexer/demultiplexer ex453, audio signal processor ex454, slotex464, and memory ex467 are connected via bus ex470.

When the user turns on the power button of power supply circuit ex461,smartphone ex115 is powered on into an operable state, and eachcomponent is supplied with power, for example, from a battery pack.

Smartphone ex115 performs processing for, for example, calling and datatransmission, based on control performed by main controller ex460, whichincludes a CPU, ROM, and RAM. When making calls, an audio signalrecorded by audio input unit ex456 is converted into a digital audiosignal by audio signal processor ex454, to which spread spectrumprocessing is applied by modulator/demodulator ex452 and digital-analogconversion, and frequency conversion processing is applied bytransmitter/receiver ex451, and the resulting signal is transmitted viaantenna ex450. The received data is amplified, frequency converted, andanalog-digital converted, inverse spread spectrum processed bymodulator/demodulator ex452, converted into an analog audio signal byaudio signal processor ex454, and then output from audio output unitex457.

In data transmission mode, text, still-image, or video data may betransmitted under control of main controller ex460 via user interfaceinput controller ex462 based on operation of user interface ex466 of themain body, for example. Similar transmission and reception processing isperformed. In data transmission mode, when sending a video, still image,or video and audio, video signal processor ex455 compression encodes,via the moving picture encoding method described in the aboveembodiments, a video signal stored in memory ex467 or a video signalinput from camera ex465, and transmits the encoded video data tomultiplexer/demultiplexer ex453. Audio signal processor ex454 encodes anaudio signal recorded by audio input unit ex456 while camera ex465 iscapturing a video or still image, and transmits the encoded audio datato multiplexer/demultiplexer ex453. Multiplexer/demultiplexer ex453multiplexes the encoded video data and encoded audio data using adetermined scheme, modulates and converts the data usingmodulator/demodulator (modulator/demodulator circuit) ex452 andtransmitter/receiver ex451, and transmits the result via antenna ex450.The determined scheme may be predetermined.

When video appended in an email or a chat, or a video linked from a webpage, is received, for example, in order to decode the multiplexed datareceived via antenna ex450, multiplexer/demultiplexer ex453demultiplexes the multiplexed data to divide the multiplexed data into abitstream of video data and a bitstream of audio data, supplies theencoded video data to video signal processor ex455 via synchronous busex470, and supplies the encoded audio data to audio signal processorex454 via synchronous bus ex470. Video signal processor ex455 decodesthe video signal using a moving picture decoding method corresponding tothe moving picture encoding method described in the above embodiments,and video or a still image included in the linked moving picture file isdisplayed on display ex458 via display controller ex459. Audio signalprocessor ex454 decodes the audio signal and outputs audio from audiooutput unit ex457. Since real-time streaming is becoming increasinglypopular, there may be instances in which reproduction of the audio maybe socially inappropriate, depending on the user's environment.Accordingly, as an initial value, a configuration in which only videodata is reproduced, e.g., the audio signal is not reproduced, may bepreferable; audio may be synchronized and reproduced only when an input,such as when the user clicks video data, is received.

Although smartphone ex115 was used in the above example, otherimplementations are conceivable: a transceiver terminal including bothan encoder and a decoder; a transmitter terminal including only anencoder; and a receiver terminal including only a decoder. In thedescription of the digital broadcasting system, an example is given inwhich multiplexed data obtained as a result of video data beingmultiplexed with audio data is received or transmitted. The multiplexeddata, however, may be video data multiplexed with data other than audiodata, such as text data related to the video. Further, the video dataitself rather than multiplexed data may be received or transmitted.

Although main controller ex460 including a CPU is described ascontrolling the encoding or decoding processes, various terminals ofteninclude graphics processing units (GPUs). Accordingly, a configurationis acceptable in which a large area is processed at once by making useof the performance ability of the GPU via memory shared by the CPU andGPU, or memory including an address that is managed so as to allowcommon usage by the CPU and GPU, or via separate memories. This makes itpossible to shorten encoding time, maintain the real-time nature of thestream, and reduce delay. In particular, processing relating to motionestimation, deblocking filtering, sample adaptive offset (SAO), andtransformation/quantization can be effectively carried out by the GPUinstead of the CPU in units of pictures, for example, all at once.

The invention claimed is:
 1. An encoder comprising: circuitry; andmemory coupled to the circuitry, wherein using the memory, thecircuitry, in operation: writes, into a bitstream, information relatedto a first quantization matrix; performs an up-conversion and adown-conversion on the first quantization matrix to generate a secondquantization matrix, the first quantization matrix having a first numberof rows and a first number of columns equal to the first number of rowsto form a square matrix, the second quantization matrix having a secondnumber of rows and a second number of columns different from the secondnumber of rows to form a rectangular matrix; and quantizes transformcoefficients of a current block using the second quantization matrix,wherein the up-conversion is performed on the first quantization matrixin a first direction such that one of the second number of rows and thesecond number of columns is larger than the first number of rows,without up-conversion being performed on the first quantization matrixin a second direction that is different from the first direction; andthe down-conversion is performed on the first quantization matrix in thesecond direction such that the other of the second number of rows andthe second number of columns is smaller than the first number of rows,without down-conversion being performed on the first quantization matrixin the first direction.
 2. A decoder comprising: circuitry; and memorycoupled to the circuitry, wherein using the memory, the circuitry, inoperation: parses, from a bitstream, information related to a firstquantization matrix; performs an up-conversion and a down-conversion onthe first quantization matrix to generate a second quantization matrix,the first quantization matrix having a first number of rows and a firstnumber of columns equal to the first number of rows to form a squarematrix, the second quantization matrix having a second number of rowsand a second number of columns different from the second number of rowsto form a rectangular matrix; and inverse quantizes quantizedcoefficients of a current block using the second quantization matrix,wherein the up-conversion is performed on the first quantization matrixin a first direction such that one of the second number of rows and thesecond number of columns is larger than the first number of rows,without up-conversion being performed on the first quantization matrixin a second direction that is different from the first direction; andthe down-conversion is performed on the first quantization matrix in thesecond direction such that the other of the second number of rows andthe second number of columns is smaller than the first number of rows,without down-conversion being performed on the first quantization matrixin the first direction.
 3. A non-transitory computer readable mediumstoring a bitstream, the bitstream including quantized coefficients of acurrent block and information according to which a decoder performs aninverse quantization process on the quantized coefficients, wherein inthe inverse quantization process: a first quantization matrix isobtained using the information, the first quantization matrix having afirst number of rows and a first number of columns equal to the firstnumber of rows to form a square matrix; a second quantization matrix isgenerated by performing an up-conversion and a down-conversion on thefirst quantization matrix, the second quantization matrix having asecond number of rows and a second number of columns different from thesecond number of rows to form a rectangular matrix; and inversequantized transform coefficients of the current block are generated fromthe quantized coefficients using the second quantization matrix, whereinthe first quantization matrix is up-converted in a first direction suchthat one of the second number of rows and the second number of columnsis larger than the first number of rows, without the first quantizationmatrix being up-converted in a second direction that is different fromthe first direction; and the first quantization matrix is down-convertedin the second direction such that the other of the second number of rowsand the second number of columns is smaller than the first number ofrows, without the first quantization matrix being down-converted in thefirst direction.